Technical References - [sendmail]

There is hardly a website that doesn't at some point need to send an email, whether through a simple contact form, or as notifications to the buyer and seller when somebody buys something. WebDNA makes this simple and straightforward.

numero = 80
interpreted = N
texte = [sendmail Parameters]Body[/sendmail] To send an email, use a SendMail context with the body of the email message inside. Specify "to," "subject," and "from" information in parameters of the SendMail context. WebDNA does not actually send the email; it writes a special file into the EmailFolder which the separate Emailer program scans nearly continuously, looking for mail to send. If the Emailer program is not running, the emails will sit there unsent. The Emailer program does not erase old outgoing email files until it has successfully completed sending the email. Then it moves them to the SentMail folder. If any of the emails are malformed and can't be sent, they are moved to the ProblemEmail folder.
[sendmail to=you@xxx.com&from=me@xxx.com&subject=Hello]This is the body of the email.The date is [date][/sendmail]
Any WebDNA inside the [sendmail] is interpreted first, such as the [date] tag above. HTML is not relevant here. The body of the [sendmail] is written to a file just as it is coded on your page, returns, running spaces and all. Do not use paragraph tags or table code or any other html. If you insert a URL, just write the URL, including the http:// portion without the <a> tags. Most email software will recognize it as a URL and make it clickable.
ParameterDescription
torecipient(s). Can be comma separated as in address@domain.com,address2@domain2.com
fromsender's email address, which should be a legitimate address allowed to send mail through your mail server
reply-to(Optional) Address the recipient's email client will insert when they reply to the mail. This can be any email address, and is useful for assuring that the recipients reply to the right person, since you must use a local address for the sender.
subjectthe subject line
any header(Optional) CC, BCC, or any extra MIME header information. For example, if you want to force the date of the email to something other than the server's default, add "Date=Mon, 05 Sep 2008 15:59:33 -0500" to the list of parameters.
saveonsuccessT or F (Optional) instructs WebDNA to save or not save the email files after successful transmission
saveonfailT or F (Optional) instructs WebDNA to save or not save the email files after failed transmission.

WebDNA does not actually send the email; it writes a special file into an EmailFolder which the separate Emailer program uses to send the email. If the Emailer program is not running, no emails will be sent. The Emailer program does not erase old outgoing email files until it has successfully completed sending the email.

The email file format conforms to Unix SendMail native mail format. You can add any extra MIME headers at the top of the file, followed by a blank line and then the body of the message. The format is basically what you see in a Eudora email message. If you wish to send emails from your own CGIs or programs (without using WebDNA's built-in [sendmail] context), you can write a text file into the EMailFolder specified in the EMailer preferences. The file must have the following format (only the text between the dashed lines goes into the email file): An example:
------- /WebCatalogEngine/EMailFolder/SomeFileName.txt -----to: support@webdna.us, WebDNA@webdna.usfrom: WebMaster@YourDomain.comsubject: This is the Subject LineDate: Mon, 05 Jan 2010 15:59:33 -0500line 1line 2line 3line 4------------------------------------------------------
Sendmail and binary files You can also send binary files (zip files, images...) using [sendmail]. Example:
[sendmail to=whoever@whereever.com&from=whoever@whereever.com&subject=testing zip attachment&Content-Type=multipart/mixed; boundary="1234abcd"&MIME-version=1.0][!][/!]--1234abcdContent-Type: text/plainThis is the first part : just plain text.The next part contains a zip file.--1234abcdContent-Type: application/x-zip-compressed; name="test.zip"Content-Transfer-Encoding: base64Content-Disposition: inline; filename="test.zip"[encrypt method=base64&file=test.zip&EMAILFORMAT=T][/encrypt]--1234abcd--[/sendmail]
Mailing a PDF (by Stuart Tremain) Send a very simple email with a .pdf attached
[SENDMAIL to=recipient@webdna.us&from=sender@webdna.us&SUBJECT=Email with attachment&Content-Type=multipart/mixed; boundary="1234abcd"&MIME-version=1.0]--1234abcdContent-Type: text/plainThe attached PDF file will open easily into Acrobat.Go here to get Adobe Acrobat: http://www.adobe.com/products/acrobat/readstep2.html--1234abcdContent-Type: text/plain; name="[_DocNo].pdf"Content-Transfer-Encoding: base64Content-Disposition: attachment; filename="[_DocNo].pdf"[ENCRYPT method=base64&file=/orderdocs/[_DocNo].pdf&EMAILFORMAT=T][/ENCRYPT]--1234abcd--[/SENDMAIL]
Mailing using html encoding (by Stuart Tremain)
[Sendmail to=[EMAILTO]&from=[EMAILFROM]&subject=[EMAILSUBJECT]&MIME-Version=1.0&Content-Type=multipart/alternative; charset=utf-8; boundary="this_is_the_boundary"&Content-Transfer-Encoding=7bit]--this_is_the_boundaryContent-Type: text/plain; charset=us-asciiContent-Transfer-Encoding: 7bit[unurl]%0D%0A[/unurl]Dear [Capitalize][CUST_FIRSTNAME][/Capitalize]We have added your details to the express checkout system.If you would like to change or delete your credit card, please login as a member and enter the details in Payment Options.https://[ListMIMEHeaders name=HOST][value][/ListMIMEHeaders]/membershipThank you for supporting original designIf you have any questions, please feel free to respond to this email or call 123456789 during business hours.Warm regards,membership co-ordinatorYou can read our terms and conditions at any time:http://[ListMIMEHeaders name=HOST][value][/ListMIMEHeaders]/terms-and-conditions[unurl]%0D%0A[/unurl]--this_is_the_boundaryContent-Type: text/html; charset=us-asciiContent-Transfer-Encoding: 7bit[unurl]%0D%0A[/unurl]<!DOCTYPE html><html lang="en"><head><meta charset="utf-8" /><style>body {margin:0;padding:20px 0px 20px 0px;}table {width:600px;border-spacing:0;border-collapse:separate;padding:0;margin:0px auto;background:white;border:0;}table.emailer {border:1px solid #666666;}td.emailhead {height:138px;background:url(http://mydomain.com/emailer/emailer-head.png) no-repeat 0 0;padding:0;border:0;vertical-align:top;}td.emailpromo {height:100px;padding:0px 0px 15px 0px;border:0px;}td.emailpromotext {padding:15px;border-bottom:1px solid #666666;}td.emailbody {color:#222222;font:12px/18px Arial, Helvetica, sans-serif;padding:0px 30px 30px 30px;}td.emailfooter {color:#222222;font:12px/18px Arial, Helvetica, sans-serif;padding:10px 0px 20px 30px;}td.emailfooter a {color:#222222;font:12px/18px Arial, Helvetica, sans-serif;text-decoration:none;}td.baseicon {width:19px;vertical-align:top;padding:6px 0px 0px 30px;}td.basetext {color:#222222;font:12px/18px Arial, Helvetica, sans-serif;padding:6px 0px 0px 12px;vertical-align:top;}td.basetext a {color:#49A3FD;font:12px/18px Arial, Helvetica, sans-serif;text-decoration:none;}img {border:0px;}table.social {width:136px;}table.social tr td {width:29px;height:29px;padding:10px 5px 0px 0px;}table.inner {width:540px;}</style></head><body>PUT ALL YOUR HTML HERE</body></html>--this_is_the_boundary--[/sendmail]
[sendmail Parameters]Body[/sendmail]

To send an email, use a SendMail context with the body of the email message inside. Specify "to," "subject," and "from" information in parameters of the SendMail context. WebDNA does not actually send the email; it writes a special file into the EmailFolder which the separate Emailer program scans nearly continuously, looking for mail to send. If the Emailer program is not running, the emails will sit there unsent. The Emailer program does not erase old outgoing email files until it has successfully completed sending the email. Then it moves them to the SentMail folder. If any of the emails are malformed and can't be sent, they are moved to the ProblemEmail folder.

[sendmail to=you@xxx.com&from=me@xxx.com&subject=Hello]
This is the body of the email.
The date is [date][/sendmail]


Any WebDNA inside the [sendmail] is interpreted first, such as the [date] tag above. HTML is not relevant here. The body of the [sendmail] is written to a file just as it is coded on your page, returns, running spaces and all. Do not use paragraph tags or table code or any other html. If you insert a URL, just write the URL, including the http:// portion without the <a> tags. Most email software will recognize it as a URL and make it clickable.

ParameterDescription
torecipient(s). Can be comma separated as in address@domain.com,address2@domain2.com
fromsender's email address, which should be a legitimate address allowed to send mail through your mail server
reply-to(Optional) Address the recipient's email client will insert when they reply to the mail. This can be any email address, and is useful for assuring that the recipients reply to the right person, since you must use a local address for the sender.
subjectthe subject line
any header(Optional) CC, BCC, or any extra MIME header information. For example, if you want to force the date of the email to something other than the server's default, add "Date=Mon, 05 Sep 2008 15:59:33 -0500" to the list of parameters.
saveonsuccessT or F (Optional) instructs WebDNA to save or not save the email files after successful transmission
saveonfailT or F (Optional) instructs WebDNA to save or not save the email files after failed transmission.


WebDNA does not actually send the email; it writes a special file into an EmailFolder which the separate Emailer program uses to send the email. If the Emailer program is not running, no emails will be sent. The Emailer program does not erase old outgoing email files until it has successfully completed sending the email.


The email file format conforms to Unix SendMail native mail format. You can add any extra MIME headers at the top of the file, followed by a blank line and then the body of the message. The format is basically what you see in a Eudora email message.
If you wish to send emails from your own CGIs or programs (without using WebDNA's built-in [sendmail] context), you can write a text file into the EMailFolder specified in the EMailer preferences. The file must have the following format (only the text between the dashed lines goes into the email file):

An example:

------- /WebCatalogEngine/EMailFolder/SomeFileName.txt -----
to: support@webdna.us, WebDNA@webdna.us
from: WebMaster@YourDomain.com
subject: This is the Subject Line
Date: Mon, 05 Jan 2010 15:59:33 -0500

line 1
line 2
line 3
line 4
------------------------------------------------------


Sendmail and binary files
You can also send binary files (zip files, images...) using [sendmail].

Example:
[sendmail to=whoever@whereever.com&from=whoever@whereever.com&subject=testing zip attachment&Content-Type=multipart/mixed; boundary="1234abcd"&MIME-version=1.0][!]
[/!]--1234abcd
Content-Type: text/plain

This is the first part : just plain text.

The next part contains a zip file.

--1234abcd
Content-Type: application/x-zip-compressed; name="test.zip"
Content-Transfer-Encoding: base64
Content-Disposition: inline; filename="test.zip"

[encrypt method=base64&file=test.zip&EMAILFORMAT=T][/encrypt]

--1234abcd--
[/sendmail]


Mailing a PDF (by Stuart Tremain)
Send a very simple email with a .pdf attached

[SENDMAIL to=recipient@webdna.us&from=sender@webdna.us&SUBJECT=Email with attachment&Content-Type=multipart/mixed; boundary="1234abcd"&MIME-version=1.0]--1234abcd
Content-Type: text/plain

The attached PDF file will open easily into Acrobat.

Go here to get Adobe Acrobat: http://www.adobe.com/products/acrobat/readstep2.html

--1234abcd
Content-Type: text/plain; name="[_DocNo].pdf"
Content-Transfer-Encoding: base64
Content-Disposition: attachment; filename="[_DocNo].pdf"

[ENCRYPT method=base64&file=/orderdocs/[_DocNo].pdf&EMAILFORMAT=T][/ENCRYPT]

--1234abcd--
[/SENDMAIL]


Mailing using html encoding (by Stuart Tremain)

[Sendmail to=[EMAILTO]&from=[EMAILFROM]&subject=[EMAILSUBJECT]&MIME-Version=1.0&Content-Type=multipart/alternative; charset=utf-8; boundary="this_is_the_boundary"&Content-Transfer-Encoding=7bit]

--this_is_the_boundary
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit[unurl]%0D%0A[/unurl]

Dear [capitalize][CUST_FIRSTNAME][/Capitalize]

We have added your details to the express checkout system.

If you would like to change or delete your credit card, please login as a member and enter the details in Payment Options.
https://[ListMIMEHeaders name=HOST][value][/ListMIMEHeaders]/membership

Thank you for supporting original design

If you have any questions, please feel free to respond to this email or call 123456789 during business hours.

Warm regards,
membership co-ordinator

You can read our terms and conditions at any time:
http://[ListMIMEHeaders name=HOST][value][/ListMIMEHeaders]/terms-and-conditions

[unurl]%0D%0A[/unurl]

--this_is_the_boundary
Content-Type: text/html; charset=us-ascii
Content-Transfer-Encoding: 7bit[unurl]%0D%0A[/unurl]

<!DOCTYPE html>
<html lang="en">
<head><meta charset="utf-8" />
<style>
body {margin:0;padding:20px 0px 20px 0px;}
table {width:600px;border-spacing:0;border-collapse:separate;padding:0;margin:0px auto;background:white;border:0;}
table.emailer {border:1px solid #666666;}
td.emailhead {height:138px;background:url(http://mydomain.com/emailer/emailer-head.png) no-repeat 0 0;padding:0;border:0;vertical-align:top;}
td.emailpromo {height:100px;padding:0px 0px 15px 0px;border:0px;}
td.emailpromotext {padding:15px;border-bottom:1px solid #666666;}
td.emailbody {color:#222222;font:12px/18px Arial, Helvetica, sans-serif;padding:0px 30px 30px 30px;}
td.emailfooter {color:#222222;font:12px/18px Arial, Helvetica, sans-serif;padding:10px 0px 20px 30px;}
td.emailfooter a {color:#222222;font:12px/18px Arial, Helvetica, sans-serif;text-decoration:none;}
td.baseicon {width:19px;vertical-align:top;padding:6px 0px 0px 30px;}
td.basetext {color:#222222;font:12px/18px Arial, Helvetica, sans-serif;padding:6px 0px 0px 12px;vertical-align:top;}
td.basetext a {color:#49A3FD;font:12px/18px Arial, Helvetica, sans-serif;text-decoration:none;}
img {border:0px;}
table.social {width:136px;}
table.social tr td {width:29px;height:29px;padding:10px 5px 0px 0px;}
table.inner {width:540px;}
</style>
</head>
<body>


PUT ALL YOUR HTML HERE

</body>
</html>

--this_is_the_boundary--

[/sendmail]

Terry Wilson

DOWNLOAD WEBDNA NOW!

Top Articles:

AWS Raw WebDNA LAMP-Plus WebServer

Amazon Web Services (AWS) README for Machine Image ID...

Download WebDNA Applications

WebDNA applications...

WebDNA reference

...

F.A.Q

A compilation of some user's questions...

WebDNA Modules

A list of the currently available modules...

Technical Change History

This Technical Change History provides a reverse chronological list of WebDNA changes...

Related Readings:

[url]

[url]...

[findstring]

[FindString Source=...

[showif]

[showif Comparison]Show This HTML[/showif]...

[object]

Embeds the results of an external function...

[lastautonumber]

displays the last auto-generated number...

[tcpconnect]

A powerful feature to connect to a TCP port of another computer on the Internet...