EMAIL

Top  Previous  Next

Syntax

 

email { to | {toexpr} }, { from | {fromexpr} }, { subject | {subjectexpr} }, { msgtxt | {msgtxtexpr} } [,cc "cc"|{ccexpr}] [,bcc "bcc"|{bccexpr}], [,attach "attach"|{attachexpr}] [,otherhead|oh "otherhead"|{otherheadexpr}] [,login "login"|{loginexpr}]  [,password|pswd "password"|{passwordexpr}] [,logfile filename]

 

Description

 

The PDF document being created will be emailed as an attachment upon completion, using the information supplied.  The name of the attached file is supplied with the "-o" argument on the UnForm command line, or can be overridden by setting the variable output$ in a prejob code block.

 

Each of the first 4 values is positional, and each can be a literal value or an expression enclosed in curly braces.  The to value is the only required value, and must be a fully qualified email address, or a comma-separated list of email addresses.  The from value, if supplied, must also be a fully qualified email address.  If it is not supplied, then a default address will be used from the mailcall.ini file.

 

Note that the expressions are resolved as of the last copy of the last page of the job.  If you need to use data from an initial page, use a prejob code block to assign variables, and then use those variables in the expressions.

 

In order to use this command, the prog/mailcall.ini file must be edited to configure a mail server (server=value) line, and optionally fixed login and password information.  The file is self-documenting, or you can use the server manager to configure the standard entries.  Note also the deliver command offers more flexibility than the email command.  The email command is a legacy command.

 

The msgtxt value can contain line-feed characters to break lines.  These characters can be added in expressions as CHR(10) functions or as $0A$ hex literals, or with the literal backslash-n (\n) character sequence.  Note that if the message text starts with a structure "<value>", then it is assumed to be an HTML message, and the appropriate header tag is set to send the message as HTML.

 

Optional arguments can follow the message text value in any order, prefixed by the appropriate option name:

 

cc

Followed by a literal that is, or an expression in curly braces that resolves to, a list of email addresses separated by commas.  These addresses become the CC, or carbon copy, list for the email.

bcc

Followed by a literal that is, or an expression in curly braces that resolves to, a list of email addresses separated by commas.  These addresses become the BCC, or blind carbon copy, list for the email.  Blind carbon copy addresses are stripped from the email header before the message is sent.

attach

Followed by a literal that is, or an expression in curly braces that resolves to, a list of additional attachment files, separated by commas.  Note that the PDF job itself is always emailed as an attachment, so only use this option for adding additional attachments to the message.

otherhead or oh

Followed by a literal that is, or an expression in curly braces that resolves to, one or more line-feed or "\n" delimited custom email headers.

login

Followed by a literal that is, or an expression in curly braces that resolves to, a login name.  Some mail servers are configured to require a login and password for authentication.  This value and the password value are then required.

password or pswd

Followed by a literal that is, or an expression in curly braces that resolves to, a login password.  Some mail servers are configured to require a login and password for authentication.  This value and the login value are then required.

logfile

Followed by a file name to which SMTP logging will be written.  The file name may contain substitution tags as documented in the deliver command.

 

 

 

Example

 

prejob{

email_to$=trim(get(1,1,50))

invoice_no$=get(60,5,6)

}

 

email {email_to$}, "sales@acme.com", {"Invoice number "+invoice_no$}, "Please pay the attached invoice promptly.\n\nBest regards,\n\nAcme Distributing", cc "accounting@acme.com"

 

 

Drivers: pdf only