Hi Folks,
As the standard AX 2012 feature we can schedule any report to send it as attachment on periodic basis. Though standard SysMailerNet class fails if you do not provide any email id in cc. To fix this issue; change the quickSend method of SysMailerNet class as mentioned below:
public void
quickSend(str fromAddr, str toAddr, str
subject, str body, str cc='',
str attachments='')
{
SysMailerNetAddressField tos;
SysMailerNetAddressField ccs;
SysMailerNetAttachments mailAttachments;
SysEmailParameters parameters;
List
emailAddresses;
ListEnumerator enum;
;
this.fromAddress(fromAddr);
tos =
this.tos();
emailAddresses = SysEmailDistributor::splitEmail(toAddr);
enum =
emailAddresses.getEnumerator();
while(enum.moveNext())
{
tos.add(enum.current());
}
this.subject(subject);
this.htmlBody(body);
//USR-Start
ccs =
this.ccs();
emailAddresses = SysEmailDistributor::splitEmail(cc);
enum =
emailAddresses.getEnumerator();
while(enum.moveNext())
{
ccs.add(enum.current());
}
/*if (!prmisDefault(cc))
{
ccs = this.ccs();
ccs.add(cc);
}*/
//USR-End
if (!prmisDefault(attachments))
{
mailAttachments = this.attachments();
mailAttachments.add(attachments);
}
this.priority(System.Net.Mail.MailPriority::Normal);
parameters = SysEmailParameters::find();
if (parameters.smtpRelayServerName)
{
this.smtpRelayServer(parameters.smtpRelayServerName,parameters.smtpPortNumber,parameters.smtpUserName,SysEmailParameters::password(),parameters.ntlm);
}
this.sendMail();
}