use of com.fsck.k9.mail.Address in project k-9 by k9mail.
the class RealImapConnection method connect.
private Socket connect() throws GeneralSecurityException, MessagingException, IOException {
Exception connectException = null;
InetAddress[] inetAddresses = InetAddress.getAllByName(settings.getHost());
for (InetAddress address : inetAddresses) {
try {
return connectToAddress(address);
} catch (IOException e) {
Timber.w(e, "Could not connect to %s", address);
connectException = e;
}
}
throw new MessagingException("Cannot connect to host", connectException);
}
use of com.fsck.k9.mail.Address in project k-9 by k9mail.
the class MailToTest method testGetTo_singleEmailAddress.
@Test
public void testGetTo_singleEmailAddress() {
Uri uri = Uri.parse("mailto:test@abc.com");
MailTo mailToHelper = MailTo.parse(uri);
Address[] emailAddressList = mailToHelper.getTo();
assertEquals(emailAddressList[0].getAddress(), "test@abc.com");
}
use of com.fsck.k9.mail.Address in project k-9 by k9mail.
the class MailToTest method testGetCc_multipleEmailAddress.
@Test
public void testGetCc_multipleEmailAddress() {
Uri uri = Uri.parse("mailto:test1@abc.com?cc=test3@abc.com,test4@abc.com");
MailTo mailToHelper = MailTo.parse(uri);
Address[] emailAddressList = mailToHelper.getCc();
assertEquals(emailAddressList[0].getAddress(), "test3@abc.com");
assertEquals(emailAddressList[1].getAddress(), "test4@abc.com");
}
use of com.fsck.k9.mail.Address in project k-9 by k9mail.
the class MailToTest method testGetBcc_singleEmailAddress.
@Test
public void testGetBcc_singleEmailAddress() {
Uri uri = Uri.parse("mailto:?bcc=test3@abc.com");
MailTo mailToHelper = MailTo.parse(uri);
Address[] emailAddressList = mailToHelper.getBcc();
assertEquals(emailAddressList[0].getAddress(), "test3@abc.com");
}
use of com.fsck.k9.mail.Address in project k-9 by k9mail.
the class MimeMessageParseTest method getRecipients_withXOriginalTo.
@Test
public void getRecipients_withXOriginalTo() throws Exception {
MimeMessage msg = parseWithoutRecurse(toStream("From: <adam@example.org>\r\n" + "To: <eva@example.org>\r\n" + "X-Original-To: <test@mail.com>\r\n" + "Subject: Testmail\r\n" + "MIME-Version: 1.0\r\n" + "Content-type: text/plain\r\n" + "Content-Transfer-Encoding: 7bit\r\n" + "\r\n" + "this is some test text."));
Address[] xOriginalAddresses = msg.getRecipients(RecipientType.X_ORIGINAL_TO);
assertEquals(1, xOriginalAddresses.length);
assertEquals(new Address("<test@mail.com>"), xOriginalAddresses[0]);
}
Aggregations