Tag: Email body

Split text multiple lines in Email body

HI, Below smaple code used to show splited text in email body.

{

SysMailer mailer;
SysEmailParameters parameters;
InteropPermission permission = new InteropPermission(InteropKind::ComInterop);
OWIStoreTable OWIStoreTable;
Notes bodymsg, bodymsghtml;
ListIterator iterator;
List strlist=new List(Types::String);
;
permission.assert();
mailer = new SysMailer();
parameters = SysEmailParameters::find();

if (parameters.SMTPRelayServerName)
{
mailer.SMTPRelayServer(parameters.SMTPRelayServerName,
parameters.SMTPPortNumber,
parameters.SMTPUserName,
SysEmailParameters::password(),
parameters.NTLM);
}
else
{
mailer.SMTPRelayServer(parameters.SMTPServerIPAddress,
parameters.SMTPPortNumber,
parameters.SMTPUserName,
SysEmailParameters::password(),
parameters.NTLM);
}

mailer.fromAddress(‘test@AX.com’);
mailer.tos().appendAddress(‘AAA@gmail.com’);
mailer.subject(‘System Test’);

strlist =strSplit(‘AAA  BBB’,”\n”);

iterator = new ListIterator(strlist);

while(iterator.more())
{
bodymsg += strFmt(“%1<br>”,iterator.value());
iterator.next();
}

bodymsg = strReplace(bodymsg,’\n’,'<br>’);
bodymsg =bodymsg + “\n” + strFmt(“Last order %2 received for this webtore on: %1”, _lastSalesOrder.createdDateTime);

bodymsghtml= strFmtLB(bodymsg);

mailer.htmlBody(bodymsghtml);

mailer.sendMail();
}

Advertisements