We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Email Merge with Aspose.Words

I am trying to merge a document that should be sent as email like this:

// Fill the fields in the document with user data.
MailMergeSettings settings = doc.getMailMergeSettings();
settings.setMainDocumentType(MailMergeMainDocumentType.EMAIL);
settings.setMailSubject("Test Email Merge");
settings.setAddressFieldName("eMail");
settings.setDestination(MailMergeDestination.EMAIL);
doc.setMailMergeSettings(settings);
doc.getMailMerge().execute(

new String[] {"VollName", "eMail", "Address", "Address2", "City"},

new Object[] {"James Bond", "brian@siteforce.de", "Milbank", "", "London"});

// Save the document in Word format.
doc.save("/Users/bp/Projekte/MailMergeTest/" + "PersonalizedLetter Out.doc", SaveFormat.DOC);

However, I can’t figure out how to actually get it to send the email messages, and the resulting doc is just an already merged DOC file.

This message was posted using Aspose.Live 2 Forum

Sorry, but Aspose.Words will not email documents for you. It is just outside of the scope.
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 in your case, but what you want to do with the resulting document - is entirely up to you. You need to write code for emailing. Maybe you can use Aspose.Network to send emails (if they have this functionality for Java).