CREATEMAIL Create an e-mail message |
Top Previous Next |
This command builds an e-mail message to be sent using the SENDMAIL command. The recipient of a message is specified in the SENDMAIL command.
All of the arguments to this command are required; however the [ from name ], [ subj ], and [ attach ] arguments may be empty strings.
The [ body ] variable provides for a simple message body. The message body cannot be longer than 2040 characters. Use an attachment file to send larger messages.
Carriage control within the message body (i.e., a \n to insert a line feed in the message and a \r to insert a carriage return) is permitted unless the /nocrlf option is specified. Use of the option /nocrlf suppresses the recognition of the \n and \r sequences. This is useful if you are e-mailing file names in the message body that may include either of these two sequences. When using the /nocrlf option the %crlf internal variable is still available for adding line breaks to your email body text.
Consider the following example where an e-mail message is created with an attachment.
SET from = "Acme Widget Co. Sales" SET email = "[email protected]" SET subj = "Thanks for your order!" SET body = "An invoice is attached" SET attach = "c:\sales\customer.inv" CREATEMAIL from email subj body attach
The following example results in a message without an attachment.
SET from = "Acme Widget Co. Sales" SET email = "[email protected]" SET subj = "Thanks for your order!" SET body = "We appreciate your business." CREATEMAIL from email subj body ""
The following example results in a two line message body.
SET body = "Line 1.\r\nLine 2."
Warning: By default, the MS Outlook mail reader "helps" format plain text messages by not displaying "extra" line breaks. This can essentially ruin all the hard work you put into formatting emails sent by Robo-FTP. You can defeat this feature by understanding what causes Outlook to remove line breaks. Outlook will not show line breaks if a line goes over 40 characters in length unless the line ends with a period, question mark, exclamation, tab, or at least three spaces or begins with a tab or at least two spaces. Obviously this is subject to change if Microsoft changes Outlook.
Only a single file may be be attached but you can use the ZIP command to combine multiple source files into a single archive and send that instead:
ZIP "attach.zip" "c:\web_dev\index.html" /create ZIP "attach.zip" "c:\web_dev\style.css" ZIP "attach.zip" "c:\web_dev\script.js" ZIP "attach.zip" "c:\web_dev\logo.gif" ZIP "attach.zip" "c:\web_dev\map.gif" ZIP "attach.zip" "c:\web_dev\storefront.jpg" SET body = "Hello Team, " + %crlf + %crlf SET body = body + "The current version of the web page is attached." + %crlf + %crlf SET body = body + "Regards, " + %crlf + "John Smith (via Robo-FTP)" CREATEMAIL "" "j.smith" "Home page" body "attach.zip"
Important To cut down on spam, some mail servers now require that the email address in the FROM line match an existing mailbox on the server. If your mail server returns an error when you call the SENDMAIL command, please check the FROM email address. Also, to fight botnets, some Internet Service Providers are now blocking outbound traffic on port 25 by default so you may need to contact your network administrator or ISP before using an external mail server.
Related command(s): SENDMAIL, GETMAIL, MAILTO See also: %crlf, Sending and Receiving E-mail, Sending SMS text messages
|