Package javax.mail

Examples of javax.mail.Address


     */
    public void sendMail( MimeMessage message ) throws MessagingException
    {
        MailAddress sender = new MailAddress( ( InternetAddress ) message.getFrom()[0] );
        Collection recipients = new HashSet();
        Address addresses[] = message.getAllRecipients();
        for ( int i = 0; i < addresses.length; i++ ) {
            recipients.add( new MailAddress( ( InternetAddress ) addresses[i] ) );
        }
        sendMail( sender, recipients, message );
    }
View Full Code Here


            //Return the message to that address, not to the Reply-To address
            reply.setRecipient( MimeMessage.RecipientType.TO, new InternetAddress( orig.getHeader( RFC2822Headers.RETURN_PATH )[0] ) );
        }
        //Create the list of recipients in our MailAddress format
        Collection recipients = new HashSet();
        Address addresses[] = reply.getAllRecipients();
        for ( int i = 0; i < addresses.length; i++ ) {
            recipients.add( new MailAddress( ( InternetAddress ) addresses[i] ) );
        }
        //Change the sender...
        reply.setFrom( bouncer.toInternetAddress() );
View Full Code Here

        assertNull(builder.getMimeMessage().getFrom());

        builder.setFrom(null);
        Address[] array = null;
        final Address addr = InternetAddress.getLocalAddress(null);
        if (addr != null) {
            array = new Address[] { addr };
        }
        assertArrayEquals(array, builder.getMimeMessage().getFrom());
View Full Code Here

  @Parameters
  public static Collection<Object[]> parameters() throws AddressException
  {
    String validAddress1 = "address1";
    String validAddress2 = "address2";
    Address address1 = new InternetAddress(validAddress1);
    Address address2 = new InternetAddress(validAddress2);
    ArrayList<Address> to = new ArrayList<Address>();
    to.add(address1);
    to.add(address2);
   
    return Arrays.asList(new Object[][] {
View Full Code Here

   
  {
    if(messageContent == null)
      throw new QwertoMailerException("Message is null");
    String charset = messageContent.getCharset();
    Address from = messageContent.getAddressFrom();
    if(from == null)
      throw new QwertoMailerException("From email has not been specified");
 
    if(emailsTo == null || emailsTo.isEmpty())
    {
View Full Code Here

  throws QwertoMailerException, Exception
  {
    if(messageContent == null)
      throw new QwertoMailerException("Message is null");
    String charset = messageContent.getCharset();
    Address from = messageContent.getAddressFrom();
    if(from == null)
      throw new QwertoMailerException("From email has not been specified");
 
    if(personParameters == null || personParameters.isEmpty())
    {
View Full Code Here

    String contentType = null;
    if(content instanceof Multipart)
      contentType = ((Multipart)content).getContentType();
    else
      contentType = mailMessage.getContentType();
    Address from = mailMessage.getAddressFrom();
    String subject = mailMessage.getSubject();
    String charset = mailMessage.getCharset();
    String contentTransferEncoding = mailMessage.getContentTransferEncoding();
   
    message.setFrom(from);
View Full Code Here

            //Return the message to that address, not to the Reply-To address
            reply.setRecipient(MimeMessage.RecipientType.TO, new InternetAddress(orig.getHeader(RFC2822Headers.RETURN_PATH)[0]));
        }
        //Create the list of recipients in our MailAddress format
        Collection recipients = new HashSet();
        Address addresses[] = reply.getAllRecipients();
        for (int i = 0; i < addresses.length; i++) {
            recipients.add(new MailAddress((InternetAddress)addresses[i]));
        }
        //Change the sender...
        reply.setFrom(bouncer.toInternetAddress());
View Full Code Here

     *                            on the spool
     */
    public void sendMail(MimeMessage message) throws MessagingException {
        MailAddress sender = new MailAddress((InternetAddress)message.getFrom()[0]);
        Collection recipients = new HashSet();
        Address addresses[] = message.getAllRecipients();
        if (addresses != null) {
            for (int i = 0; i < addresses.length; i++) {
                // Javamail treats the "newsgroups:" header field as a
                // recipient, so we want to filter those out.
                if ( addresses[i] instanceof InternetAddress ) {
View Full Code Here

        reply.setSentDate(new Date());
        reply.setHeader(RFC2822Headers.RETURN_PATH,"<>");
        //Create the list of recipients in our MailAddress format
        Collection recipients = new HashSet();
        Address addresses[] = reply.getAllRecipients();
        if (addresses != null) {
            for (int i = 0; i < addresses.length; i++) {
                // Javamail treats the "newsgroups:" header field as a
                // recipient, so we want to filter those out.
                if ( addresses[i] instanceof InternetAddress ) {
View Full Code Here

TOP

Related Classes of javax.mail.Address

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.