Email Functionality - Which API to use as a developer...

Hi,

I’m trying to build an automatic email system that will send Order Acknowledgment, Shipping Advice and Invoice Notification to our customers.

The system will be driven by the Job Queue and run daily.

I’m currently using the “Document-Mailing” codeunit to send the actual emails but I have found many draw backs with it.

The document Mailing has 5 procedure available and non of them offer CC or BCC options.

They are also very limited by the size of the TO field (250 Characters)

The Stream Options (vs File Options) do not offer HTML Body options

I’m listing the 5 procedures here:

EmailFile(AttachmentFilePath: Text[250], AttachmentFileName: Text[250], HtmlBodyFilePath: Text[250], PostedDocNo: Code[20], ToEmailAddress: Text[250], EmailDocName: Text[250], HideDialog: Boolean, ReportUsage: Integer): Boolean

EmailFileFromStream(AttachementStream: InStream, AttachmentName: Text, Body: Text, Subject: Text, MailTo: Text, HideDialog: Boolean, ReportUsage: Integer): Boolean

EmailFileWithSubject(AttachmentFilePath: Text, AttachmentFileName: Text, HtmlBodyFilePath: Text, EmailSubject: Text, ToEmailAddress: Text, HideDialog: Boolean): Boolean

EmailFileWithSubjectAndReportUsage(AttachmentFilePath: Text[250], AttachmentFileName: Text[250], HtmlBodyFilePath: Text[250], EmailSubject: Text[250], PostedDocNo: Code[20], ToEmailAddress: Text[250], EmailDocName: Text[250], HideDialog: Boolean, ReportUsage: Integer): Boolean

EmailHtmlFromStream(MailInStream: InStream, ToEmailAddress: Text[250], Subject: Text, HideDialog: Boolean, ReportUsage: Integer): Boolean

In the case of the sales invoice header, I would like to update the “Electronic Document Sent” flag but I get an permission issue error even though I’m SUPER.

Is there a better API I should be looking at?

Should I just write my own?

Office 365 has a limit of 3 threads and 30 emails per minute, I would like to be able to queyue all these emails instead of sleeping the process when it runs too.

We are on prem, v13 of Business Central

Thanks

Yann