IF ISCLEAR(objOL) THEN CREATE(objOL, FALSE, TRUE); objNS := objOL.GetNamespace('MAPI'); IF SMTPInfo.FINDFIRST THEN BEGIN FromMail := SMTPInfo."User ID"; FromPwd := SMTPInfo.Password; END; objNS.Logon(FromMail, FromPwd, FALSE, TRUE); InteractionTemplateRec.SETRANGE("Campaign No.", CampaignNo); IF InteractionTemplateRec.FINDFIRST THEN BEGIN InteractionTemplateRec.CALCFIELDS("Attachment No."); IF AttachmentRec.GET(InteractionTemplateRec."Attachment No.") THEN BEGIN AttachmentPath := 'C:\Temp\attachment.docx'; AttachmentRec.ExportAttachment(AttachmentPath); IF ISCLEAR(wdApp) THEN CREATE(wdApp, FALSE, TRUE); wdDoc := wdApp.Documents.Open(AttachmentPath); objMail := wdDoc.MailEnvelope.Item; objMail.Display(FALSE); objMail.BodyFormat := 2; objMail.Subject := InteractionTemplateRec."E-mail Subject"; objMail."To" := ToEmail; objMail.Send; wdDoc.Close; CLEAR(wdDoc); CLEAR(wdApp); END; END; CLEAR(objOL); END;
This message is for C/AL programmers: The call to member MailEnvelope failed: Unspecified error (Exception from HRESULT: 0x80004005(E_FAIL)).
Comments
I guess it´s worth a Customer Source support call...