TextMailProcess

Top  Previous  Next

TextMailProcess can be used to send text based e-mails to mail recipient with or without attachments.

  <process name="ProcessForm1.TextMailProcess1" basedon="mor.Mailer.TextMailProcess">
    <param name="smtpAccount">SMTPAccount1</param>
    <param name="to">@vof(EMAIL)</param>
    <param name="cc"></param>
    <param name="bcc"></param>
    <param name="subject">Order confirmation</param>
    <param name="message">
Dear @vof(NAME),

This is to notify that we've received your order request.
The order number is "@vof(ORDER_NUMBER)"

Regards,
Sales Team
    </param>
    <param name="attachs">invoice.pdf | invoices/I006761526.pdf</param>
  </process>

 

Note that this process connects to the SMTP server when its prepare() method is called, accumulates the mails during processRecord() method calls and sends the mails when its finalizeProcess() method is called.

 

Parameters

smtpAccount (Accepts MScript)

The SMPT account defined with smtpAccount configuration element.

to,cc,bcc (Accepts MScript)

These elements define the mail recipients.

subject (Accepts MScript)

The subject text of your E-mail message. The subject text is encoded using the encoding of the current page.

message (Accepts MScript)

The message text of your E-mail message. The message text is encoded using the encoding of the current page.

attachs (Accepts MScript)

One or more file names can be specified in this parameter (by delimiting them with commas) as mail attachments. The names can be defined relative to the web application root or can be absolute file names.

Syntax:

[attachment-name | ] file-name [, [attachment-name | file-name ] ]

 

attachment-name

The name of the attachment that will appear in the e-mail. When this optional parameter is omitted the file-name is used as the attachment name.

 

file-name

The name of the file to be attached. It can be an absolute file path or it can be defined relative to the web application root.

A process block field name or a pool variable name can also be given instead of a file name. If this is the case the PB field or pool variable should contain the file object of the file. Using this feature, for example, a PDF document created and placed in a pool variable as a file object by a preceding process can be attached to the e-mail.
 

Examples:

Definition

Attached Object

Attachment names in e-mail

a.doc

File {APPLICATION_ROOT}/a.doc

a.doc

c:\data\a.doc, b.pdf

File c:\data\a.doc and
File {APPLICATION_ROOT}/b.pdf

a.doc, b.pdf

/tmp/docs/a.pdf, b.pdf | docs/000.pdf

File /tmp/docs/a.pdf and
File {APPLICATION_ROOT}/docs/000.pdf

a.pdf, b.pdf

a.pdf | v:pdf1, b.pdf | /tmp/1.pdf 

File Object in pool variable pdf1 and
File /tmp/1.pdf

a.pdf, b.pdf

a.pdf | f:pdf1

File Object in Process Block Field pdf1

a.pdf

 

How does the process work?

- prepare() method of the process establishes a connection with the specified SMTP server
- processRecord() method prepares a mail and inserts it in to a mail queue (it does not sent it immediately)
- finalizeProcess() method starts sending the mails in the mail queue.