Package br.gov.frameworkdemoiselle.mail

Examples of br.gov.frameworkdemoiselle.mail.MailException


    try {
      textBodyPart.setDisposition(ContentDisposition.INLINE.headerValue());
      textBodyPart.setText(text, charset);
    } catch (MessagingException e) {
      throw new MailException("Can't set Text Body", e);
    }

    return textBodyPart;
  }
View Full Code Here


      try {
        relatedMultipart.addBodyPart(createHTMLBodyPart(message.getHtmlBody()));
        relatedBodyPart.setContent(relatedMultipart);
        multipart.addBodyPart(relatedBodyPart);
      } catch (MessagingException e) {
        throw new MailException("Can't set email content", e);
      }
    }
  }
View Full Code Here

    MimeBodyPart htmlBodyPart = new MimeBodyPart();
    try {
      htmlBodyPart.setDisposition(ContentDisposition.INLINE.headerValue());
      htmlBodyPart.setText(html, charset, "html");
    } catch (MessagingException e) {
      throw new MailException("Can't create HTML Body Part", e);
    }

    return htmlBodyPart;
  }
View Full Code Here

      try {
        messageBodyPart.setDataHandler(new DataHandler(datasource));
        messageBodyPart.setFileName(attachment.getFileName());
        multipart.addBodyPart(messageBodyPart);
      } catch (MessagingException e) {
        throw new MailException("Can't add attachment.", e);
      }
    }
  }
View Full Code Here

      setImportance();
      setAttachments();
      mimeMessage.setSubject(message.getSubject(), charset);
      setContent();
    } catch (Exception e) {
      throw new MailException("Error preparing e-mail message", e);
    }

    return mimeMessage;
  }
View Full Code Here

      super.setFileName(fileName);
      super.setMimeType(urlDataSource.getContentType());
      super.setContentDisposition(contentDisposition);
      super.setBytes(bytes);
    } catch (MalformedURLException e) {
      throw new MailException("Cant create attachment from URL", e);
    } catch (IOException e) {
      throw new MailException("Cant create attachment from URL", e);
    }
  }
View Full Code Here

      super.setFileName(fileDataSource.getName());
      super.setMimeType(fileDataSource.getContentType());
      super.setContentDisposition(contentDisposition);
      super.setBytes(toByteArray(file));
    } catch (IOException e) {
      throw new MailException("Can't create File Attachment", e);
    }
  }
View Full Code Here

  public Header(String name, String value) {
    this.name = name;
    try {
      this.value = MimeUtility.fold(name.length() + 2, MimeUtility.encodeText(value));
    } catch (UnsupportedEncodingException e) {
      throw new MailException("Can't create header", e);
    }
  }
View Full Code Here

        if (mailLookupClass != null) {
          Lookup lookup;
          try {
            lookup = (Lookup) Class.forName(mailLookupClass).newInstance();
          } catch (Exception e) {
            throw new MailException("Error in mail lookup class configuration: " + mailLookupClass, e);
          }
          jndi = lookup.getMailName();
        } else {
          jndi = Lookup.DEFAULT_MAIL_NAME;
        }

        try {
          InitialContext ctx = new InitialContext();
          session = (Session) ctx.lookup(jndi);
        } catch (Exception e) {
          throw new MailException("Error in lookup mail session " + jndi, e);
        }
        break;
      default:
        throw new MailException("Mail Type not implemented");
    }
    return session;
  }
View Full Code Here

TOP

Related Classes of br.gov.frameworkdemoiselle.mail.MailException

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.