Ax 使用outlook 发送邮件
https://technet.microsoft.com/en-us/library/aa834374.aspx
static void sendEmialbyOutlook(Args _args)
{
Description255 recipientEmail;
Notes emailBody;
Description255 subjectText;
Filename fileName;
SmmOutlookEmail smmOutlookEmail = new SmmOutlookEmail();
recipientEmail = "receivedEmail@126.com";
subjectText = "Test Email";
fileName = @"C:\Users\chloel\Documents\1-Files\0-sql\APadjust.sql";
emailBody = "Hi,\nThis is a test email for Dyanmics AX.\nThanks.";
if (smmOutlookEmail.createMailItem())
{
smmOutlookEmail.addEMailRecipient(recipientEmail);
smmOutlookEmail.addSubject(subjectText);
smmOutlookEmail.addFileAsAttachment(fileName);
smmOutlookEmail.addBodyText(emailBody);
smmOutlookEmail.sendEMail(smmSaveCopyOfEMail::No,false);
}
else
{
error("Could not communicate with Microsoft Outlook Client.");
}
}
网友评论