Email Send an email
|Top Previous Next|
This command builds an e-mail message and sends it using an email server configuration defined in the configurator's Output Email menu. It can also override any of the settings found in there.
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.
The EMAIL command does not support using wildcards to specify an attach or embed argument. If you need to send an attachment where the name of the file is not known ahead of time, you can accomplish this using the GETFILE command, as in the following example.
GETFILE "C:\PATH\TO\FILES\*.txt" ;; returns the first file that matches the criteria
EMAIL "Message body." /server="myemailconfig" /subject="Home page" /attach=%nextpath /from="j.smith <email@example.com>"
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 EMAIL 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. Check the tracelog for more details on why an email server rejected an email.
Consider the following example for building an e-mail message that will contain embedded images:
SET email_subject = "Example"
SET html_body = '<html><body><img src="cid:CID_0000000002@Robo-FTP" />'
SET html_body &= '<img src="cid:CID_0000000001@Robo-FTP" /></body></html>"
SET text_body = "Contents for email clients that can't display HTML."
EMAIL text_body /server="myemailconfig" /subject="Embedded images syntax 1" /htmlbody=html_body /embed="image_big.jpg" /embed="image_small.jpg"
In the example above, note that the src attribute for the img tags contain a number. This number must correspond to the order that the images were given in the EMAIL command. That is, the correct src attribute for displaying the first image specified in the EMAIL tag is: src="cid:CID_0000000001@Robo-FTP". The correct src attribute for displaying the second image specified in the EMAIL tag is: src="cid:CID_0000000002@Robo-FTP".
Consider the following alternate syntax for adding a embedded images:
EMAIL text_body /server="myemailconfig" /subject="Embedded images syntax 1" /htmlbody=html_body /embed="image_big.jpg|image_small.jpg"
In the example above, instead of specifying multiple images with multiple "/embed=" options, a single "/embed=" option is used to specify multiple images, with each image separated by a "pipe" character (|). This alternate syntax is functionally equivalent to the command in the first example, but is particularly useful for scripts that build e-mails which contain a variable number of embedded images.