Send email from action
Send email from action
Hi,
I am trying to create a simple Stateless form to send email to selected records.
the main form: 'Register' includes email field 'Email'
the Stateless form: 'Emailtoselection' includes mulltiline field
'RegID', and Email_Subject and Email_Message fields.
I basically followed this
post where Cyril M explains and my code looks like this:
function to open Emailtoselection form and below that the sendmail
function for the Send button:
- void
SendEmail_toselection(Register rec)
{
openUrl("#Form:Emailtoselection&RegID=" +
(rec.ID.getall()), "Popup window", "height=400,width=600");
}
- mailinglist=input.RegID.toList();
for
each mID in mailinglist
{
benefic = Register [ID ==
mID];
sendmail
[
from:zoho.loginuserid
to:benefic.Email
subject:"input.Email_Subject"
message:"input.Email_Message "
content
type:HTML
]
}
The first function works well and all ID,s are comma separated in the
multiline field.
The second function gives an error, the fourth line benefic = Register
[ID == mID] is invalid because ID is BIGINT and mID is a string. So how
can I get the email IDs fetched with that mailinglist as reference?
Please help!
2. Also, if this is going to work, is there a way to attach a file to
the email through the stateless form. Cannot add an upload field, since
it is stateless, but is there another way, through an url maybe?