Logo 
Search:

Java Answers

Ask Question   UnAnswered
Home » Forum » Java       RSS Feeds
  Question Asked By: Meenachi Suppiah   on Aug 13 In Java Category.

  
Question Answered By: Sheraz Khan   on Aug 13


public static void main(String[] args)
{
String strBaseFolder = "D:\\Data\\Aspose\\resources\\";
System.out.println("Creating new messages....");

// Create a new instance of MailMessage class
MailMessage message = new MailMessage();
// Set sender information
message.setFrom(new MailAddress("from@domain.com", "Sender Name", false));

// Add recipients
message.getTo().add(new MailAddress("to1@domain.com", "Recipient 1", false));
message.getTo().add(new MailAddress("to2@domain.com", "Recipient 2", false));

// Set subject of the message
message.setSubject("New message created by Aspose.Email for Java");

// Set Html body
message.setHtmlBody("This line is in bold. <br/> <br/>" +
"<font color=blue>This line is in blue color</font>");

// Save message in EML, MSG and MHTML formats
message.save(strBaseFolder + "Message.eml", MailMessageSaveType.getEmlFormat());
message.save(strBaseFolder + "Message.msg", MailMessageSaveType.getOutlookMessageFormat());
message.save(strBaseFolder + "Message.mhtml", MailMessageSaveType.getMHtmlFromat());
System.out.println("Messages created successfuly");
}

Please use Aspose.Email for Java: http://www.aspose.com/java/email-component.aspx for this code. Thanks

Share: 

 

This Question has 4 more answer(s). View Complete Question Thread

 
Didn't find what you were looking for? Find more on email program in java Or get search suggestion and latest updates.


Tagged: