mirror of
https://github.com/moparisthebest/davmail
synced 2024-12-13 03:02:22 -05:00
SMTP: compare actual email address, not email with alias
git-svn-id: http://svn.code.sf.net/p/davmail/code/trunk@1329 3d1905a2-6b24-0410-a738-b14d5a86fcbd
This commit is contained in:
parent
bd12bbd30e
commit
889673e3e3
@ -959,10 +959,10 @@ public abstract class ExchangeSession {
|
||||
Set<String> visibleRecipients = new HashSet<String>();
|
||||
Address[] recipients = mimeMessage.getAllRecipients();
|
||||
for (Address address : recipients) {
|
||||
visibleRecipients.add(address.toString());
|
||||
visibleRecipients.add(((InternetAddress)address).getAddress().toLowerCase());
|
||||
}
|
||||
for (String recipient : rcptToRecipients) {
|
||||
if (!visibleRecipients.contains(recipient)) {
|
||||
if (!visibleRecipients.contains(recipient.toLowerCase())) {
|
||||
mimeMessage.addRecipient(javax.mail.Message.RecipientType.BCC, new InternetAddress(recipient));
|
||||
}
|
||||
}
|
||||
|
@ -173,6 +173,15 @@ public class TestSmtp extends AbstractDavMailTestCase {
|
||||
sendAndCheckMessage(mimeMessage);
|
||||
}
|
||||
|
||||
public void testComplexToMessage() throws IOException, MessagingException, InterruptedException {
|
||||
String body = "Test message";
|
||||
MimeMessage mimeMessage = new MimeMessage((Session) null);
|
||||
mimeMessage.addHeader("To", "nickname <"+Settings.getProperty("davmail.to")+ '>');
|
||||
mimeMessage.setSubject("Test subject");
|
||||
mimeMessage.setText(body);
|
||||
sendAndCheckMessage(mimeMessage);
|
||||
}
|
||||
|
||||
public void testQuit() throws IOException {
|
||||
writeLine("QUIT");
|
||||
assertEquals("221 Closing connection", readLine());
|
||||
|
Loading…
Reference in New Issue
Block a user