Hi Ajit,
I did it, still maills are not reaching to recipients.
Job code is like below.
public static server void sendMail(RefRecId _RefRecId,FileName _FileName)
{
sysMailer sysMailer;
str body;
GVHEArchiveTrans GVHEArchiveTrans = GVHEArchiveTrans::findRecId(_RefRecId);
GVHEArchiveParameters GVHEArchiveParameters = GVHEArchiveParameters::find();
str 100 EmailAddress;
CustTable lvCustTable;
LogisticsPostalAddress LogisticsPostalAddress;
LogisticsLocation LogisticsLocation;
CustInvoiceJour lvCustInvoiceJour;
InteropPermission InteropPermission;
;
InteropPermission = new InteropPermission(InteropKind::ComInterop);
InteropPermission.assert();
//VTU E-Archive****
if(GVHEArchiveTrans.CustInvoiceJourRecId)
{
lvCustTable = CustTable::find(GVHEArchiveTrans.InvoiceAccount);
if (lvCustTable.BRI_EArchiveMailAddress)
EmailAddress = lvCustTable.BRI_EArchiveMailAddress;
else
{
lvCustInvoiceJour = CustInvoiceJour::findRecId(GVHEArchiveTrans.CustInvoiceJourRecId);
select firstonly LogisticsLocation
join LogisticsPostalAddress
where LogisticsPostalAddress.Location == LogisticsLocation.RecId
&& LogisticsPostalAddress.RecId == lvCustInvoiceJour.InvoicePostalAddress;
EmailAddress = LogisticsLocation.BRI_EArchiveMailAddress;
}
}
//VTU E-Archive****
else
EmailAddress = VendTable::find(GVHEArchiveTrans.VendAccount).email();
sysMailer = new sysMailer();
if(SysEmailParameters::find().SMTPRelayServerName)
sysMailer.SMTPRelayServer(SysEmailParameters::find().SMTPRelayServerName,
SysEmailParameters::find().SMTPPortNumber,
SysEmailParameters::find().SMTPUserName,
SysEmailParameters::password(),
SysEmailParameters::find().NTLM
);
else
sysMailer.SMTPRelayServer(SysEmailParameters::find().SMTPServerIPAddress,
SysEmailParameters::find().SMTPPortNumber,
SysEmailParameters::find().SMTPUserName,
SysEmailParameters::password(),
SysEmailParameters::find().NTLM
);
sysMailer.fromAddress(GVHEArchiveParameters.FromEmail);
sysMailer.subject(strFmt("TEST - %1 ",lvCustTable.name()));
sysMailer.tos().appendAddress(EmailAddress);//CustTable.BuzInvoiceEmail);
sysMailer.attachments().add(_FileName);
sysMailer.htmlBody(strfmt("This mail is for test.",GVHEArchiveTrans.InvoiceNum));
sysMailer.sendMail();
}