It is possible using AX 2009 to create email body in Lotus Notes and attach pdf or xls files inside email in needed place providing text for each attached file, and make this embedded objects clickable and possibility to rename them?
Try this job as a test with your file...
static void TestEmails(Args _args)
{
System.Net.Mail.MailMessage mailMessage;
System.Net.Mail.Attachment attachment;
System.Net.Mail.AttachmentCollection attachementCollection;
System.Net.Mail.SmtpClient smtpClient;
System.Net.Mail.MailAddress emailfrom;
System.Net.Mail.MailAddress emailto;
str messageBody;
str Subject;
str SMTPServer;
str Filenm;
FileIOPermission permission1;
str fileToSend;
;
fileToSend = "P:\\Tests\\TestFile.pdf";
emailfrom = new System.Net.Mail.MailAddress("[email protected]","");
emailTo = new System.Net.Mail.MailAddress("[email protected]","");
messageBody = "Test Body";
Subject = "Test Subject";
SMTPServer = SysEmailParameters::find(false).SMTPRelayServerName;
mailMessage = new System.Net.Mail.MailMessage(emailfrom, emailTo);
mailmessage.set_Subject(Subject);
mailmessage.set_Body(messageBody);
attachementCollection = mailMessage.get_Attachments();
Filenm = fileToSend;
permission1= new FileIOPermission(Filenm,'w');
permission1.assert();
attachment = new System.Net.Mail.Attachment(Filenm);
attachementCollection.Add(attachment);
smtpClient = new System.Net.Mail.SmtpClient(SMTPServer);
smtpClient.Send(mailmessage);
CodeAccessPermission::revertAssert();
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With