Send an Invoice to a Customer (Part 2 of sending an email using a specific email address)
- Josh
- 5 days ago
- 1 min read
Following on from setting up a codeunit to send from a specific email address (defined on the Sales & Receivables setup)
We need to do the following steps:
Get the email address of the customer
Build an email body
Build and attach a pdf of the invoice report
Get the email address of the customer
Business Central allows you to define document layouts per customer, so we should first check here to see if an email address has been defined, if not, let's use the customer email address.
Note: I have now added Sales Invoice Header to the function:

We need several more variables added to the function and add the following lines of code

Lets build an email body to a customer, an alternative here is to develop code to bring in a word template:
Update the EmailMessage Create use CustomerEmail, Subject and our new body text.

We included 2 new variables to complete the process: BodyText and EmailSubject

I hope this helps you send an email from Business Central using the following:
Sent from a specific email address
Use of Document Layouts to get the email
Attached a PDF of the invoice
Created a custom email body
Please reach out if you have any questions.



Comments