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.

[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.

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.

torecipient(s). Can be comma separated as in,
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 -----
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].

[sendmail zip attachment&Content-Type=multipart/mixed; boundary="1234abcd"&MIME-version=1.0][!]
Content-Type: text/plain

This is the first part : just plain text.

The next part contains a zip file.

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

[encrypt method=base64&][/encrypt]


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

[SENDMAIL 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:

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]


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{it]

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


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" />
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( 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;} {width:136px;} tr td {width:29px;height:29px;padding:10px 5px 0px 0px;}
table.inner {width:540px;}





Terry Wilson


Top Articles:

WebDNA Libraries

A list of available libraries for WebDNA...

Technical Change History

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


A compilation of some user's questions...

WebDNA Modules

A list of the currently available modules...

WebDNA reference

A list of all WebDNA instructions...

Download WebDNA Applications

WebDNA applications...

Related Readings:


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




Replaces each found record in a database with the new field values...

DB encryption

Database Automatic Encryption (from WebDNA 8...


When listing files...


[delete db=some...