To send email from a survey, use the send email
widget. Survey Programmers (SPs) can define email parameters, as well as a condition for sending messages. This might be used to inform respondents after they have finished the survey that they will be compensated for their time, to send additional information that a respondent might have opted-in to, and so on. Email content can be defined within the survey source, or from a file stored in a survey's local files directory. The send email
widget also accepts HTML, allowing the email to display rich content.
Syntax
Basic
sendemail from: from email address to: recipient email address subject: email subject line text: Message body of email
Additional tags
The following list of tags is commonly used with the send email
widget.
Tag | Description |
---|---|
always |
Specifies whether an e-mail message is sent every time a respondent views a page that triggers the send command for that message. |
attach |
Specifies a file attachment for an e-mail message. |
bcc |
Specifies an e-mail address, or a comma-separated list of e-mail addresses, that should receive a blind copy (Bcc) of the outgoing e-mail message. |
bcc name |
Specifies a descriptive name to insert in place of the blind copy (bcc) address for an outgoing e-mail message. |
cc |
Specifies an e-mail address, or a comma-separated list of e-mail addresses, that should receive a copy (cc) of the outgoing e-mail message. |
cc name |
Specifies a descriptive name to insert in place of the copy (cc) address for an outgoing e-mail message. |
charset |
Specifies the encoding character set for the message. The default is the character set of the survey where the send email widget is located. |
condition |
Specifies logic that must be true before the e-mail will be sent. |
from |
Specifies the source (from) e-mail address, or a comma-separated list of e-mail addresses, for an outgoing e-mail message. |
from name |
Specifies a descriptive name to insert in place of the source (from) address for an outgoing e-mail message. |
html |
Specifies the HTML version of the e-mail message that should be sent instead of the plain text version. |
html file |
Specifies an HTML file that contains the body of the e-mail message you want to send. The file must be stored in the /_s/ directory. The file name must then be supplied here without a path. |
language |
Specifies the language that the e-mail was written in. |
onload |
Specifies that an e-mail should be sent when a survey page is loaded instead of when the page is submitted. |
plaintext |
Specifies that the e-mail message should be sent as plain text only. |
send email |
Specifies to the survey software that a send email widget will be used. Must be the first tag used when using a send email widget. |
subject |
Specifies the subject of an e-mail message. |
text |
Specifies the text for an e-mail message. If the message of the text is longer, or has separate paragraphs to it, you will want to use the text tag as follows: text: <<ENDMSG . . . ENDMSG . |
text file |
Specifies a plain ASCII text file that contains the body of the e-mail message you want to send. The file must be stored in the /_s/ directory. The file name must then be supplied here without a path. |
to |
Specifies the target (To) e-mail address, or a comma-separated list of e-mail addresses, for an outgoing e-mail message. |
to name |
Specifies a descriptive name to insert in place of the target (To) address for an outgoing e-mail message. |
Examples
Sending an email (text only)
In the following example, an email is sent to a respondent if they choose to hear more about a contest to win a free iPad. Since the email message has multiple paragraphs, the message text uses heredoc syntax. These are unnecessary if a single paragraph message is used.
Sending an email with attachment
In order to send an attachment (pdf, jpg/png, etc.), upload the file(s) you wish to send in the _ s folder under the Structure > Files tab. The attach
tag simply requires the name of the file to be sent, as it is designed to reference the _s folder.
The from name
tag is also used in this example to allow the SP to replace the return/sender email address with the sender's name.
Sending an email with html
The following example includes html
to format the appearance of the email the respondent receives, specifying both the font style and font size, and includes a link to the survey. A pdf attachment is also included.
Note that the always
tag is applied to the send email
widget, specifying that an e-mail message should be sent every time a respondent views a page that triggers the send command for that message. The optional onload: y
is also applied, which specifies that an e-mail should be sent when a survey page is loaded instead of when the page is submitted. The newpage
must be included after Q2A for onload
to work.
If it is preferred that the email is sent when the page is submitted, simply omit onload: y
and the newpage
before the send email
widget.
Comments
0 comments
Please sign in to leave a comment.