Hi All,
I have added one attachment (.pdf file)to the Site ‘A’ and i want to email this attachment using code. To email the attachment i have used the following code but i get the attachment in unknown format. Please suggest me how can i resolve this?
InventSite site = InventSite::find('A');
DocuRef docuRef;
DocuValue docuValue;
SysMailerMessageBuilder mailer = new SysMailerMessageBuilder();
SysMailerSMTP smtp = new SysMailerSMTP();
docuRef = DocuRef::findTableIdRecId(curExt(), tableNum(InventSite), site.RecId);
mailer.setSubject("Testing Attachment");
mailer.setFrom("xx@yy.com");
mailer.setBody("PFA");
mailer.addTo("aa@zz.com");
mailer.addAttachment(DocumentManagement ::getAttachmentStream(docuRef),docuRef.Name);
try
{
smtp.sendNonInteractive(mailer.getMessage());
}
Thanks in advance…