CREATEMAIL        Create an e-mail message

Top  Previous  Next

Syntax:

CREATEMAIL

[ from name ] [ from email ] [ subj ] [ body ] [ attach ] [ options ]

Arguments:

[ from name ]

Variable or string defining the optional name of the sender; this argument is required in the command even if you do not specify a sender - in this case be sure to specify an empty string (e.g., "").

 

[ from email ]

Variable or string defining the e-mail address of the sender.

 

[ subj ]

Variable or string defining an optional subject line for the e-mail message; this argument is required in the command even if you do not have a subject line - in this case be sure to specify an empty string (e.g., "").

 

[ body ]

Variable or string defining the body of the message.

 

[ attach ]

Variable or string defining the file name of an optional attachment for the e-mail message; this argument is required in the command even if you do not have an attachment - in this case be sure to specify an empty string (e.g., "").

Options:

/nocrlf

Ignore embedded \n and/or \r carriage control

 

 

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

 

Important

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

 

 

Related Command(s): SENDMAIL, GETMAIL, MAILTO

See also: %crlf