Email        Send an email

<< Click to Display Table of Contents >>

Navigation:  Robo-FTP User's Guide > Script Programming > Script Commands > All Script Commands >

Email        Send an email

Syntax:

EMAIL

[ Message Body ]

Arguments:

[ Message Body ]

Variable or string defining the text body of an email message.  

Options:

/server=xx

Select an email server configuration other than the default.

 

/host=xx

Override the email server configuration's smtp server defintion

 

/port=xx

Override the Server port

 

/user=xx

Override the User ID

 

/pw=xx

Overrride the Password

 

/ssl=xx

Override the TLS settings. /ssl=none for plain text, /ssl=explicit for explicit TLS and /ssl=implicit for Implicit TLS. If the port is 25 or 587 this should be none or explicit. If it 465 it should be implicit. For any alternate non standard ports ask the mail server administrator.

 

/from=xx

Override the from address. See

 

/to=xx

Override the to address

 

/cc=xx

Override the CC To addresses. This option may contain multiple addresses separated by a comma.

 

/bcc=xx

override the BCC To addresses. This option may contain multiple addresses separated by a comma.

 

/subject=xx

override the Subject.

 

/attach=xx

add an attachment to the email. This option may occur more than once to add multiple attachments or it can be passed a pipe separated list of filenames.

 

/htmlbody=xx

Specify an HTML body for the email. Use this to create a pretty message using HTML.

 

/embed=xx

Embed content in the email to be linked to by the HTML body. The /embed option creates embedded content that may be accessed from the html body with incrementing urls starting with the form

cid:CID_0000000001@Robo-FTP

And counting up with each one added. This option may occur more than once or it may contain a pipe separated list of files.

 

/trust=xx

Action to take when an untrusted certificate is received from a TLS-secured mail server. Available options are ALLOW, ALL, PROMPT, and DENY. The default action if this option is not specified is DENY.

 

 

 

 

 

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 protected]>"

 

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

 

Email format for arguments to the the /to, /from, /cc, and /bcc options

 

These options accept an argument of the following form: Display Name <emailaddress>. Here, "Display Name" is simply an arbitrary name that will be displayed in the email client. Usually, the desired value for this is the full name of the owner of the associated email address, but that is not required. Consider the following example of this as used in the /to option, below:

 

 EMAIL "Please respond." /subject="Re: Compensation" /to="Thomas Edison <[email protected]" /from="Nikola Tesla <[email protected]>"

 

The /cc= and /bcc options will accept multiple addresses separated by spaces. Note the /bcc option in the following example:

 

 EMAIL "Begin operation Thunderball" /subject="For your eyes only" /to="James Bond <[email protected]>" /bcc="Miss Moneypenny <[email protected]>, Ernst Blofeld <[email protected]>"

 

Embedded images

 

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.

 

Related command(s): GETMAIL, MAILTO

See also: Sending and Receiving E-mail, Sending SMS text messages