Package com.aspose.email

Examples of com.aspose.email.MailMessage


public class AsposeConverter
{
  public static void main(String[] args)
  {
      // Initialize and Load an existing MSG file by specifying the MessageFormat
      MailMessage msg = MailMessage.load("data/message.msg", MessageFormat.getMsg());

      // Save the Email message to disk by specifying the EML and MHT MailMessageSaveType
      msg.save("data/AsposeMessage.eml", MailMessageSaveType.getEmlFormat());
      msg.save("data/Asposemessage.mhtml", MailMessageSaveType.getMHtmlFromat());
     
      System.out.println("Done");
  }
View Full Code Here


  public static void main(String[] args)
  {
    String sender = "test@gmail.com";
    String recipient = "test@email.com";

    MailMessage message = new MailMessage(sender, recipient, "", "");

    Calendar calendar = Calendar.getInstance(TimeZone.getTimeZone("GMT"));
    calendar.set(2012, Calendar.NOVEMBER, 1, 0, 0, 0);
    Date startDate = calendar.getTime();
    calendar.set(2012, Calendar.DECEMBER, 1);
    Date endDate = calendar.getTime();

    MailAddressCollection attendees = new MailAddressCollection();
    attendees.addMailAddress(new MailAddress("attendee_address@aspose.com", "Attendee"));
    WeeklyRecurrencePattern expected = new WeeklyRecurrencePattern(3);

    Appointment app = new Appointment("Appointment Location", "Appointment Summary", "Appointment Description",
            startDate, endDate,
            new MailAddress("organizer_address@aspose.com", "Organizer"), attendees, expected);

    //Set the Appointment as Draft
    app.setMethod(AppointmentMethodType.Publish);//.Method = AppointmentMethodType.Publish;

    message.addAlternateView(app.requestApointment());

    MapiMessage msg = MapiMessage.fromMailMessage(message);

    // Save the appointment as draft.
    msg.save("data/AsposeDraft.msg");
View Full Code Here

public class AsposeLoadEmailMsg
{
  public static void main(String[] args)
  {
    //Create MailMessage instance by loading an Eml/Msg/Emlx/Mht file
    MailMessage messageMSG   = MailMessage.load("data/message.msg", MessageFormat.getMsg());
    MailMessage messageEML   = MailMessage.load("data/message.eml", MessageFormat.getEml());
    MailMessage messageEMLX = MailMessage.load("data/message.emlx", MessageFormat.getEmlx());
    MailMessage messageMHT   = MailMessage.load("data/message.mht", MessageFormat.getMht());
  }
View Full Code Here

public class AsposeShowHidePrintHeaders
{
  public static void main(String[] args)
  {
    MailMessage message = MailMessage.load("data/message.eml");
    String encodedPageHeader = "<div><div class=3D'page=Header'>&quot;Panditharatne, Mithra&quot; &lt;mithra=2Epanditharatne@cibc==2Ecom&gt;<hr/></div>";
   
    int saveOptions =  MailMessageSaveOptions.HideExtraPrintHeader;
    message.save("data/AsposeHideExtraHeaders.mhtml", MailMessageSaveType.getMHtmlFormat(), saveOptions);
   
    System.out.println("Done");
  }
View Full Code Here

public class AsposeReadOFT
{
  public static void main(String[] args)
  {
    // Load the Outlook template (OFT) file in MailMessage's instance
    MailMessage message = MailMessage.load("data/sample.oft", MessageFormat.getMsg());

    // Set the sender and recipients information
    String senderDisplayName = "John";
    String senderEmailAddress = "john@abc.com";
    String recipientDisplayName = "William";
    String recipientEmailAddress = "william@xzy.com";

    message.setSender(new MailAddress(senderEmailAddress, senderDisplayName));
    message.getTo().addMailAddress(new MailAddress(recipientEmailAddress, recipientDisplayName));
    message.setHtmlBody(message.getHtmlBody().replace("DisplayName", "<b>" + recipientDisplayName + "</b>"));

    // Set the name, location and time in email body
    String meetingLocation = "<u>" + "Hall 1, Convention Center, New York, USA" + "</u>";
    String meetingTime = "<u>" + "Monday, June 28, 2010" + "</u>";
    message.setHtmlBody(message.getHtmlBody().replace("MeetingPlace", meetingLocation));
    message.setHtmlBody(message.getHtmlBody().replace("MeetingTime", meetingTime));
   
    // Save the message in MSG format and open in Office Outlook
    MapiMessage mapimessage = new MapiMessage().fromMailMessage(message);
    mapimessage.setMessageFlags(MapiMessageFlags.MSGFLAG_UNSENT);
    mapimessage.save("data/AsposeInvitation.msg");
View Full Code Here

public class AsposeEmailSave
{
  public static void main(String[] args)
  {
    MailMessage messageMSG   = MailMessage.load("data/message.msg", MessageFormat.getMsg());
   
    messageMSG.save("data/AsposeMessage.msg", MessageFormat.getMsg());
    messageMSG.save("data/AsposeMessage.eml", MessageFormat.getEml());
    messageMSG.save("data/AsposeMessage.emlx", MessageFormat.getEmlx());
    messageMSG.save("data/AsposeMessage.mht", MessageFormat.getMht());
  }
View Full Code Here

public class AsposeMsgBody
{
  public static void main(String[] args) throws Exception
  {
    MailMessage msg = MailMessage.load("data/message.msg", MessageFormat.getMsg());

    System.out.println("Body:"+ msg.getBody());
    System.out.println("Text Body:"+ msg.getTextBody());
    System.out.println("Text Body HTML:"+ msg.getHtmlBody());
  }
View Full Code Here

    WeeklyRecurrencePattern expected = new WeeklyRecurrencePattern(3);

    Appointment app = new Appointment("Appointment Location", "Appointment Summary", "Appointment Description",
                      startDate, endDate,
                      new MailAddress("organizer_address@domain.com", "Organizer"), attendees, expected);
    MailMessage msg = new MailMessage();
    msg.addAlternateView(app.requestApointment());
    MapiMessage mapi = MapiMessage.fromMailMessage(msg);
    MapiCalendar cal = (MapiCalendar)mapi.toMapiMessageItem();

    cal.setRemainderSet(true);
    cal.setRemainderDelta(58);//58 min before start of event
View Full Code Here

public class AsposeAttachments
{
  public static void main(String[] args)
  {
MailMessage message = MailMessage.load("data/message.msg", MessageFormat.getMsg());

System.out.println("Extracting attachments....");
for (int i = 0; i < message.getAttachments().size(); i++)
{
    Attachment att = (Attachment) message.getAttachments().get_Item(i);
    System.out.println("Attachment Name: " + att.getName());

    // Get the name of attachment. If msg subject contains characters like :, /, \ etc., replace with space
    // because windows cannot save files with these characters
    // also save first 50 characters as file name to avoid long file names
View Full Code Here

public class AsposeMsgHeaders
{
  public static void main(String[] args)
  {
    MailMessage message = MailMessage.load("data/message.msg", MessageFormat.getMsg());

    //Gets Email Headers
    System.out.println("From: "   + message.getFrom());
    System.out.println("To: "     + message.getTo());
    System.out.println("CC: "     + message.getCC());
    System.out.println("Bcc: "     + message.getBcc());
    System.out.println("Subject: "   + message.getSubject());
  }
View Full Code Here

TOP

Related Classes of com.aspose.email.MailMessage

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.