Sending merged documents as emails in bulk

Hi there,

We use Aspose.Words to generate documents in bulk. Is there a way to bulk email these documents using the default MS Office Mail Merge functionality?



Hi Patrick,

Thanks for your inquiry. Aspose.Words does not send email documents. It is just outside of the scope.

Please note that Aspose.Words is a document processing library that supports various document formats very well. It will inject data from your data source into a document but what you want to do with the resulting document - is entirely up to you. You need to write code for emailing. You may use Aspose.Email to send emails.

Moreover, you can use Document.MailMergeSettings to set MainDocumentType as MailMergeMainDocumentType.Email. This saves the detail in the output document. Please see the following code snippet for your kind reference.

Document doc = new Document(MyDir + "in.docx");
MailMergeSettings mms = doc.MailMergeSettings;
mms.MailSubject = "Aspose.Words";
mms.MainDocumentType = MailMergeMainDocumentType.Email;
mms.DataType = MailMergeDataType.Spreadsheet;
mms.LinkToQuery = true;
mms.ViewMergedData = true;
mms.DataSource = MyDir + "Book1.xlsx";
mms.Query = "SELECT * FROM " + mms.DataSource;
doc.Save(MyDir + "out.docx");

Hope this helps you. Please let us know if you have any more queries.