Package au.com.cahaya.asas.net.mail

Examples of au.com.cahaya.asas.net.mail.JavaMailClient


   * @param file
   */
  protected void send (InternetAddress from, InternetAddress to, String subject,
      File file)
  {
    JavaMailClient mc = new JavaMailClient (System.getProperty("mail.smtp.host"));
   
    AttachmentMessage message = new AttachmentMessage (mc.getSession ());
    try {
      message.setFrom(from);
      message.setRecipient (Message.RecipientType.TO, to);
      message.setSubject (subject);
      message.attachDescription ("Test message", MimeEnumType.eTextPlain);
     
      //ByteArrayDataSource ds = new ByteArrayDataSource ("A short little message".getBytes (), MimeEnumType.eTextXml.toString ());
      //ds.setName ("test.txt");
      //message.attach (ds);
      if (file != null) {
        message.attachFile (file);
      }
     
      message.prepareToSend ();
    }
    catch (MessagingException exc) {
      myLog.error ("send", exc);
    }
    mc.send(message);
  }
View Full Code Here

TOP

Related Classes of au.com.cahaya.asas.net.mail.JavaMailClient

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.