Creating and Sending Multiple Email Messages
You can create several emails and send them all in a single connection to the SMTP server. However, your system administrator may also need to configure the SMTP server with longer connection time-outs if you are sending multiple emails.
import PT_MCF_MAIL:*;
/*-- Create an email object by setting individual parameters
---*/
Local array of PT_MCF_MAIL:MCFOutboundEmail &mails;
Local PT_MCF_MAIL:MCFOutboundEmail &email;
Local PT_MCF_MAIL:SMTPSession &commonSession =
create PT_MCF_MAIL:SMTPSession();
&email = &commonSession.CreateOutboundEmail();
&email.From = &FromAddress;
&email.Recipients = &ToList1;
&email.Subject = &Subject;
&email.Text = &MailBody1;
&mails = CreateArray(&email);
&email = &commonSession.CreateOutboundEmail();
&email.From = &FromAddress;
&email.Recipients = &ToList2;
&email.Subject = &Subject;
&email.Text = &MailBody2;
&mails [2] = &email;
&email = &commonSession.CreateOutboundEmail();
&email.From = &FromAddress;
&email.Recipients = &ToList3;
&email.Subject = &Subject;
&email.Text = &MailBody3;
&mails [3] = &email;
Local array of integer &allRes = &commonSession.SendAll(&mails);