Send Word Document in Email Body using C++

Emails are the primary source of communication over the internet and in the majority of cases, the layout and formatting of the email is important. However, most of the email clients do not provide the enhanced formatting options required for designing high-quality email content. In such cases, a well-formatted Word document can be used as the body of the email. In this article, you will learn how to send a Word document as the body of the email using C++.

C++ APIs for Sending Word Documents In Email Body

In order to send a Word document in an email body, we will use the Aspose.Words for C++ and Aspose.Email for C++ APIs. The former allows you to generate, modify and convert Microsoft Word files. Whereas the latter allows you to create, manipulate, and convert Outlook files. We will use Aspose.Words for C++ API to convert the Word document to MHTML format and Aspose.Email for C++ API to generate and send the email. You can either install the APIs through NuGet or download them directly from the Downloads section.

PM> Install-Package Aspose.Words.Cpp
PM> Install-Package Aspose.Email.Cpp

Sending a Word Document in an Email Body using C++

The following are the steps to send a Word document in an email body:

The following sample code shows how to send a Word document as the body of an email using C++.

Get a Free License

You can try the API without evaluation limitations by requesting a free temporary license.


In this article, you have learned how to send a Word document in an email body using C++. To summarize, you learned how to convert a Word document to MHTML format using Aspose.Words for C++ API and how to send MHTML as an email using Aspose.Email for C++ API. Both of these APIs provide numerous features for working with MS Word and email files. You can explore these APIs in detail by visiting their official documentation. In case of any questions, please feel free to reach us on our free support forum.

See Also