Skip to content
Permalink
Browse files
JAMES-1620 getEnvelopeTo should return first not null address
git-svn-id: https://svn.apache.org/repos/asf/james/jsieve/trunk@1720543 13f79535-47bb-0310-9956-ffa450edef68
  • Loading branch information
chibenwa committed Dec 17, 2015
1 parent bc70f0e commit 7ca2d58a630be387053b9c2e4674873edb234975
Showing 1 changed file with 21 additions and 20 deletions.
@@ -17,21 +17,6 @@
* under the License. *
****************************************************************/
package org.apache.jsieve.mailet;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.Enumeration;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Set;

import javax.mail.Header;
import javax.mail.MessagingException;
import javax.mail.internet.MimeMessage;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@@ -52,6 +37,20 @@
import org.apache.mailet.Mail;
import org.apache.mailet.MailAddress;
import org.apache.mailet.MailetContext;

import javax.mail.Header;
import javax.mail.MessagingException;
import javax.mail.internet.MimeMessage;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.Enumeration;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
/**
* <p>
* Class <code>SieveMailAdapter</code> implements a <code>MailAdapter</code>
@@ -314,11 +313,13 @@ public String getEnvelopeFrom()
*/
public String getEnvelopeTo()
{
String recipient = null;
Iterator recipientIter = getMail().getRecipients().iterator();
if (recipientIter.hasNext())
recipient = recipientIter.next().toString();
return recipient;
for (MailAddress mailAddress : getMail().getRecipients()) {
String recipient = mailAddress.toInternetAddress().getAddress();
if (recipient != null) {
return recipient;
}
}
return null;
}

/**

0 comments on commit 7ca2d58

Please sign in to comment.