top of page
Search

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:

  1. Get the email address of the customer

  2. Build an email body

  3. 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:


  1. Sent from a specific email address

  2. Use of Document Layouts to get the email

  3. Attached a PDF of the invoice

  4. Created a custom email body


Please reach out if you have any questions.

 
 
 

Comments


© 2026 by The BC Developer. All rights reserved.

bottom of page