AX 2009 发邮件

if (EPCompanyParameters::find().epEmailInterfaceType == EPEmailInterfaceType::CDO)
     {
         SysEmailTable::sendMail(_emailId, _language, _emailAddr, _mappings, _attachmentFilename);
     }
     else
     {
         if (!message)
         {
             // Message not found for this language.
             message = SysEmailMessageTable::find(_emailId, table.DefaultLanguage);
         }
 
        messageBody = SysEmailMessage::stringExpand(message.Mail, _mappings);
 
        if (message)
         {
             // BP Deviation Documented
             // enable assert for COM interop
             new InteropPermission(InteropKind::ComInterop).assert();
 
            sysINetMail = new SysINetMail();
             text = new COMVariant();
             ctrl = new COM();
             // BP Deviation Documented
             document = new COM(#HTMLDocumentClassName);
 
            htmlText = WebLet::weblets2Html4Help(messageBody, '');
 
            ctrl.attach(document.interface());
             comWrite = new COMDispFunction(ctrl, 'write', COMDispContext::Method);
             text.bStr(htmltext);
             // BP Deviation Documented
             document.open('');
             // BP Deviation Documented
             comWrite.call(text);
             // BP Deviation Documented
             body = document.body();
             if (body)
                 // BP Deviation Documented
                 messageBody = body.outerText();
             else
                 messageBody = '';
             // BP Deviation Documented
             document.close();
 
            sysINetMail.sendMailAttach(_emailAddr,'',message.Subject,messageBody,false,_attachmentFilename);
 
原文地址:https://www.cnblogs.com/Footprints/p/3452929.html