Examples of EmailAttachment


Examples of org.apache.commons.mail.EmailAttachment

    public static void mail5() throws EmailException {
        HtmlEmail email = new HtmlEmail();
        email.setHtmlMsg("<html><body><h1>A Title</h1></body></html>");
        email.setTextMsg("alternative message");
        EmailAttachment attachment = new EmailAttachment();
        attachment.setDescription("An image");
        attachment.setDisposition(EmailAttachment.ATTACHMENT);
        attachment.setPath(Yalp.applicationPath.getPath() + java.io.File.separator + "test" + java.io.File.separator + "fond2.png");
        EmailAttachment attachment2 = new EmailAttachment();
        attachment2.setName("fond3.jpg");
        attachment2.setPath(Yalp.applicationPath.getPath() + java.io.File.separator + "test" + java.io.File.separator + "fond3.jpg");
        email.attach(attachment);
        email.attach(attachment2);
        email.setFrom("test@localhost");
        email.addTo("test@localhost");
        email.setSubject("test attachments");
View Full Code Here

Examples of org.apache.commons.mail.EmailAttachment

      Email email = new SimpleEmail();
      if(attachmentUrl!=null) {
        // Create the attachment
          try {
            email = new MultiPartEmail();
            EmailAttachment attachment = new EmailAttachment();
            attachment.setURL(new URL(attachmentUrl));
            attachment.setDisposition(EmailAttachment.ATTACHMENT);
            attachment.setName("Attachment");
            ((MultiPartEmail) email).attach(attachment);
        } catch (MalformedURLException e) {
          logger.error("Invalid attachment url.", e);
        } catch (EmailException e) {
          logger.error("Error adding attachment to email.", e);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.