Package javax.mail.internet

Examples of javax.mail.internet.MimeMessage.addFrom()


  {
    try {
      MimeMessage msg = new MimeMessage(getSession());

      if(_from.length > 0)
        msg.addFrom(_from);
      msg.addRecipients(RecipientType.TO, _to);
      if(subject != null)
        msg.setSubject(subject);
      msg.setContent(body, "text/plain");
View Full Code Here


    message.setSubject(subject);
    message.setRecipients(Message.RecipientType.TO,
        emailToInternetAddressArray(toEmailAddresses));
    message.setRecipients(Message.RecipientType.CC,
        emailToInternetAddressArray(ccEmailAddresses));
    message.addFrom(InternetAddress.parse(fromAddress));
    message.setSentDate(new Date());
    BodyPart mainBody = new MimeBodyPart();
    mainBody.setContent(content, "text/html;charset=gbk");
    multipart.addBodyPart(mainBody);
    for (Entry<String, String> e : mailAttachment.entrySet()) {
View Full Code Here

    message.setSubject(subject);
    message.setRecipients(Message.RecipientType.TO,
        emailToInternetAddressArray(toEmailAddresses));
    message.setRecipients(Message.RecipientType.CC,
        emailToInternetAddressArray(ccEmailAddresses));
    message.addFrom(InternetAddress.parse(fromAddress));
    message.setSentDate(new Date());
    BodyPart mainBody = new MimeBodyPart();
    mainBody.setContent(content, "text/html;charset=gbk");
    multipart.addBodyPart(mainBody);
    for (Entry<String, String> e : mailAttachment.entrySet()) {
View Full Code Here

    public void testDKIMSignMessageAsText() throws MessagingException,
            IOException, FailException {
        MimeMessage mm = new MimeMessage(Session
                .getDefaultInstance(new Properties()));
        mm.addFrom(new Address[] { new InternetAddress("io@bago.org") });
        mm.addRecipient(RecipientType.TO, new InternetAddress("io@bago.org"));
        mm.setText("An 8bit encoded body with \u20ACuro symbol.", "ISO-8859-15");

        Mailet mailet = new DKIMSign();
View Full Code Here

    public void testDKIMSignMessageAsObjectConvertedTo7Bit()
            throws MessagingException, IOException, FailException {
        MimeMessage mm = new MimeMessage(Session
                .getDefaultInstance(new Properties()));
        mm.addFrom(new Address[] { new InternetAddress("io@bago.org") });
        mm.addRecipient(RecipientType.TO, new InternetAddress("io@bago.org"));
        mm.setContent("An 8bit encoded body with \u20ACuro symbol.",
                "text/plain; charset=iso-8859-15");
        mm.setHeader("Content-Transfer-Encoding", "8bit");
        mm.saveChanges();
View Full Code Here

    public void testDKIMSignMessageAsObjectNotConverted()
            throws MessagingException, IOException, FailException {
        MimeMessage mm = new MimeMessage(Session
                .getDefaultInstance(new Properties()));
        mm.addFrom(new Address[] { new InternetAddress("io@bago.org") });
        mm.addRecipient(RecipientType.TO, new InternetAddress("io@bago.org"));
        mm.setContent("An 8bit encoded body with \u20ACuro symbol.",
                "text/plain; charset=iso-8859-15");
        mm.setHeader("Content-Transfer-Encoding", "8bit");
        mm.saveChanges();
View Full Code Here

        }
       
                msg.setRecipient(Message.RecipientType.TO, new InternetAddress(toAddress));
        InternetAddress[] fromAddr = new InternetAddress[1];
        fromAddr[0] = new InternetAddress(config.getFromAddress());
        msg.addFrom(fromAddr);
       
        msg.setSentDate(new Date());
        msg.setSubject(notification.getSubject());
       
        msg.setHeader(WGAMailNotification.HEADERFIELD_TYPE, notification.getType());
View Full Code Here

            throw new MailBuilderException("Failed to render content", e);
        }

        try {
            // from addresses
            message.addFrom(getAddresses(FROM));

            // recipients addresses
            message.setRecipients(Message.RecipientType.TO, getAddresses(TO));
            message.setRecipients(Message.RecipientType.CC, getAddresses(CC));
            message.setRecipients(Message.RecipientType.BCC, getAddresses(BCC));
View Full Code Here

            throw new MailBuilderException("Failed to render content", e);
        }

        try {
            // from addresses
            message.addFrom(getAddresses(FROM));

            // recipients addresses
            message.setRecipients(Message.RecipientType.TO, getAddresses(TO));
            message.setRecipients(Message.RecipientType.CC, getAddresses(CC));
            message.setRecipients(Message.RecipientType.BCC, getAddresses(BCC));
View Full Code Here

            throw new MailBuilderException("Failed to render content", e);
        }

        try {
            // from addresses
            message.addFrom(getAddresses(FROM));

            // recipients addresses
            message.setRecipients(Message.RecipientType.TO, getAddresses(TO));
            message.setRecipients(Message.RecipientType.CC, getAddresses(CC));
            message.setRecipients(Message.RecipientType.BCC, getAddresses(BCC));
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.