Package org.apache.commons.mail

Examples of org.apache.commons.mail.EmailAttachment


        commonsEmail.setSmtpPort(NumberTools.toInt(email.getPort(), 25));
      }

      if (email.getAttachmentFileName() != null)
      {
        EmailAttachment attachment = new EmailAttachment();

        attachment.setPath(email.getAttachmentFileName());
        attachment.setDisposition(EmailAttachment.ATTACHMENT);
        attachment.setDescription(email.getAttachmentDescription());
        attachment.setName(email.getAttachmentName());
        commonsEmail = ((MultiPartEmail) commonsEmail).attach(attachment);
      }

      commonsEmail.send();
    }
View Full Code Here


    public void communicate(IReport report) throws EmailException,
            MoDiException {

        // Create the attachment
        EmailAttachment attachment = new EmailAttachment();
        attachment
                .setPath(Config.getStringProperty("MoDi.HTMLReportFile.Path"));
        attachment.setDisposition(EmailAttachment.ATTACHMENT);
        attachment.setDescription("MoDiHTMLReport");
        attachment.setName("modireport.html");

        // Create the email message
        MultiPartEmail email = new MultiPartEmail();
        email.setHostName(mailhost);
        email.setAuthentication(username, password);
View Full Code Here

    public void communicate(IReport report) throws EmailException,
            MoDiException {

        // Create the attachment
        EmailAttachment attachment = new EmailAttachment();
        attachment
                .setPath(Config.getStringProperty("MoDi.HTMLReportFile.Path"));
        attachment.setDisposition(EmailAttachment.ATTACHMENT);
        attachment.setDescription("MoDiHTMLReport");
        attachment.setName("modireport.html");

        // Create the email message
        MultiPartEmail email = new MultiPartEmail();
        email.setHostName(mailhost);
        email.setAuthentication(username, password);
View Full Code Here

    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(Play.applicationPath.getPath() + java.io.File.separator + "test" + java.io.File.separator + "fond2.png");
        EmailAttachment attachment2 = new EmailAttachment();
        attachment2.setName("fond3.jpg");
        attachment2.setPath(Play.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

    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(Play.applicationPath.getPath() + java.io.File.separator + "test" + java.io.File.separator + "fond2.png");
        EmailAttachment attachment2 = new EmailAttachment();
        attachment2.setName("fond3.jpg");
        attachment2.setPath(Play.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

                    String type = mapping.get("type").toString();
                       
                    try {
                       
                        if ("system".equals(type)) {
                            EmailAttachment attachment = new EmailAttachment();
                            attachment.setPath(path);
                            attachment.setName(MimeUtility.encodeText(fileName));
                            email.attach(attachment);
                        } else {
                            URL u = new URL(path);
                            email.attach(u, MimeUtility.encodeText(fileName), "");
                        }
View Full Code Here

  public boolean email(String subject, String body, String toEmail, String fileAttachment, boolean deObf) throws EmailException
  {
    try
    {
      // Create the attachment
      EmailAttachment attachment = new EmailAttachment();
      attachment.setPath(fileAttachment);
      attachment.setDisposition(EmailAttachment.ATTACHMENT);
     
      // Create the email message
      MultiPartEmail email = new MultiPartEmail();
      email.setHostName(this.smtpHostname);
      if ("smtps".equals(this.smtpProtocol))
View Full Code Here

    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(Play.applicationPath.getPath() + java.io.File.separator + "test" + java.io.File.separator + "fond2.png");
        EmailAttachment attachment2 = new EmailAttachment();
        attachment2.setName("fond3.jpg");
        attachment2.setPath(Play.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

*/
public class MultiPartMail {

  public static void main(String[] args) throws IOException, EmailException {
     // Create the attachment
      EmailAttachment attachment = new EmailAttachment();
      attachment.setURL(new URL("http://www.apache.org/images/asf_logo_wide.gif"));
      attachment.setDisposition(EmailAttachment.ATTACHMENT);
      attachment.setDescription("Apache logo");
      attachment.setName("Apache_logo.gif");

      // Create the email message
      MultiPartEmail email = new MultiPartEmail();
      email.setDebug(true);
      // Set email host
View Full Code Here

    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

TOP

Related Classes of org.apache.commons.mail.EmailAttachment

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.