Package javax.mail.internet

Examples of javax.mail.internet.InternetAddress


          InternetAddress[] toAddrs =
            new InternetAddress[ (oldP == null) ? 1 : 2 ];

          toAddrs[0] =
            new InternetAddress
              ( p.getEmail(), p.getName() );

          if ( oldP != null )
            {
            toAddrs[1] =
              new InternetAddress
                ( oldP.getEmail(), oldP.getName() );
            }

          this.mailQueue.addMailJob
            ( subject, body.toString(), toAddrs, null );
View Full Code Here


          {
          InternetAddress[] toAddrs =
            new InternetAddress[ 1 ];

          toAddrs[0] =
            new InternetAddress
              ( p.getEmail(), p.getName() );

          InternetAddress[] ccAddrs = null;

          if ( repV.size() > 0 )
            {
            Vector ccV = new Vector();
            for ( int i = 0, sz = repV.size(); i < sz ; i ++ )
              {
              Report rep = (Report) repV.elementAt( i );

              Person sub =
                Person.getPerson( rep.getSubmitter() );

              if ( sub != null )
                {
                ccV.addElement
                  ( new InternetAddress
                    ( sub.getEmail(), sub.getName() ) );
                }
              }

            ccAddrs = new InternetAddress[ ccV.size() ];
View Full Code Here

   */
  public void sendNewUserNotificationMessage(String notificationMailAddress, Identity newIdentity) {
    Address from;
    Address[] to;
    try {
      from = new InternetAddress(WebappHelper.getMailConfig("mailFrom"));
      to = new Address[] { new InternetAddress(notificationMailAddress)};
    } catch (AddressException e) {
      Tracing.logError("Could not send registration notification message, bad mail address", e, RegistrationManager.class);
      return;
    }
    MailerResult result = new MailerResult();
View Full Code Here

        MimeMessage forward = new MimeMessage(session);
       
        forward.setSubject("Fw. "+message.getSubject());
       
        forward.setFrom(new InternetAddress(mailFrom));
       
        for(int i=0;i<toArray.length;i++) {
          forward.addRecipient(Message.RecipientType.TO, new InternetAddress(toArray[i]));
        }
       
        for(int i=0;i<ccArray.length;i++) {
            forward.addRecipient(Message.RecipientType.CC, new InternetAddress(ccArray[i]));
        }

        for(int i=0;i<bccArray.length;i++) {
            forward.addRecipient(Message.RecipientType.BCC, new InternetAddress(bccArray[i]));
        }
      
        BodyPart messageBodyPart = new MimeBodyPart();
        messageBodyPart.setText(forwardSubject);
View Full Code Here

      // -- Create a new message --
      Message msg = new MimeMessage(session);

      // -- Set the FROM and TO fields --
      msg.setFrom(new InternetAddress(from));
      msg.setRecipients(Message.RecipientType.TO, InternetAddress.parse(
          to, false));

      // -- We could include CC recipients too --
      // if (cc != null)
View Full Code Here

    }
   
    // Building MimeMessage
    MimeMessage mimeMessage = new MimeMessage(session);
    mimeMessage.setSubject(subject);
    mimeMessage.setFrom(new InternetAddress(from));
    mimeMessage.addRecipients(Message.RecipientType.TO, InternetAddress.parse(recipients, false));
   
    // -- Create a new message --
    BodyPart msg = new MimeBodyPart();
    msg.setDataHandler(new DataHandler(new ByteArrayDataSource(htmlBody, "text/html; charset=\"utf-8\"")));
View Full Code Here

      }

      try {
        if (fromAddr != null)
          if (fromPersonal != null && !(fromPersonal.equals("")))
            mMsg.setFrom(new InternetAddress(fromAddr, fromPersonal));
          else
            mMsg.setFrom(new InternetAddress(fromAddr));

        if (replyAddr != null && !(replyAddr.equals("")))
          if (replyPersonal != null)
            mMsg.setReplyTo(new InternetAddress[] {new InternetAddress(replyAddr, replyPersonal)});
          else
            mMsg.setReplyTo(new InternetAddress[] {new InternetAddress(replyAddr)});

      } catch (java.io.UnsupportedEncodingException uee) {
        throw new MessagingException("", uee);
      }
    }
View Full Code Here

      }

      try {
        if (fromAddr != null)
          if (fromPersonal != null && !(fromPersonal.equals("")))
            pHeaders.setHeader("From", new InternetAddress(fromAddr, fromPersonal).toString());
          else
            pHeaders.setHeader("From", new InternetAddress(fromAddr).toString());

        if (replyAddr != null && !(replyAddr.equals("")))
          if (replyPersonal != null)
            pHeaders.setHeader("Reply-To", new InternetAddress(replyAddr, replyPersonal).toString());
          else
            pHeaders.setHeader("Reply-To", new InternetAddress(replyAddr).toString());

      } catch (java.io.UnsupportedEncodingException uee) {
        throw new MessagingException("", uee);
      }
    }
View Full Code Here

   * @param emailString supposed email string.
   * @return whether the string is a valid email.
   */
  public static boolean isEmail(String emailString) {
    try {
      new InternetAddress(emailString);
     
      if (emailString.indexOf('@') == -1) return false;
    }
    catch (AddressException e) {
      return false;
View Full Code Here

      }

      if (status == null) {
  // check to see if it's a valid address
  try {
    InternetAddress newAddress = new InternetAddress(addressText);
    status = new SelectionStatus(addressText, VALID);
  } catch (javax.mail.internet.AddressException ae) {
    status = new SelectionStatus(addressText, INVALID);
  }
      }
View Full Code Here

TOP

Related Classes of javax.mail.internet.InternetAddress

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.