Package javax.mail

Examples of javax.mail.Address


            //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();
        for (int i = 0; i < addresses.length; i++) {
            recipients.add(new MailAddress((InternetAddress)addresses[i]));
        }
        sendMail(sender, recipients, message);
    }
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();
        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();
        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

        if (addresses == null) {
            return null;
        }

        if (addresses.length > 0) {
            Address addr = addresses[0];
            if (addr instanceof InternetAddress) {
                emailAddress = (InternetAddress)addr;
            }
        }
View Full Code Here

    /*
     * Calls findPartyFromEmailAddress service and returns a List of the results for the array of addresses
     */
    private static List buildListOfPartyInfoFromEmailAddresses(Address [] addresses, GenericValue userLogin, LocalDispatcher dispatcher) throws GenericServiceException {
        InternetAddress emailAddress = null;
        Address addr = null;
        Map map = null;
        Map result = null;
        List tempResults = FastList.newInstance();

        if (addresses != null) {
View Full Code Here

     * @param normalizedMessage the normalized message from JBI
     * @throws javax.mail.MessagingException if the message could not be constructed or there was an error creating an address
     */
    public void prepareMessage(MimeMessage mimeMessage, MessageExchange exchange, NormalizedMessage normalizedMessage) throws javax.mail.MessagingException {
        try {
            Address to = getTo(exchange, normalizedMessage);
            if (to != null) {
                mimeMessage.setRecipient(Message.RecipientType.TO, to);
            }
            Address cc = getCc(exchange, normalizedMessage);
            if (cc != null) {
                mimeMessage.setRecipient(Message.RecipientType.CC, cc);
            }
            Address bcc = getBcc(exchange, normalizedMessage);
            if (bcc != null) {
                mimeMessage.setRecipient(Message.RecipientType.BCC, bcc);
            }
            Address from = getFrom(exchange, normalizedMessage);
            if (from != null) {
                mimeMessage.setFrom(from);
            }
            String text = getText(exchange, normalizedMessage);
            if (text != null) {
View Full Code Here

            props.put("mail.host", getMailHost());

            Session mailConnection = Session.getInstance(props,
                null);
            Message msg = new MimeMessage(mailConnection);
            Address sender = new InternetAddress(MAIL_SENDER + "@"
                + getMailHost(), MAIL_SENDER);
            Address[] receivers = receiverAddresses(getRecipientAddress());

            // Set mail content and subject
            msg.setContent(message, "text/plain");
View Full Code Here

      }
      Session session = Session.getDefaultInstance(properties, authenticator);
//      session.setDebug(true);
      Message message = new MimeMessage(session);
      message.setFrom(new InternetAddress(mailFrom));
      Address address[] = new Address[1];
      address[0] = new InternetAddress(mailFrom);
      message.setReplyTo(address);
      message.setRecipients(Message.RecipientType.TO, InternetAddress.parse(mailTo, false));
      message.setSubject(subject);
      message.setContent(body, contentType);
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.