Search in sources :

Example 81 with Address

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);
}
Also used : MessagingException(com.fsck.k9.mail.MessagingException) IOException(java.io.IOException) InetAddress(java.net.InetAddress) CertificateValidationException(com.fsck.k9.mail.CertificateValidationException) GeneralSecurityException(java.security.GeneralSecurityException) KeyManagementException(java.security.KeyManagementException) SSLException(javax.net.ssl.SSLException) NoSuchAlgorithmException(java.security.NoSuchAlgorithmException) SocketException(java.net.SocketException) ConnectException(java.net.ConnectException) IOException(java.io.IOException) CertificateException(java.security.cert.CertificateException) MessagingException(com.fsck.k9.mail.MessagingException) AuthenticationFailedException(com.fsck.k9.mail.AuthenticationFailedException)

Example 82 with Address

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");
}
Also used : Address(com.fsck.k9.mail.Address) Uri(android.net.Uri) Test(org.junit.Test)

Example 83 with Address

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");
}
Also used : Address(com.fsck.k9.mail.Address) Uri(android.net.Uri) Test(org.junit.Test)

Example 84 with Address

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");
}
Also used : Address(com.fsck.k9.mail.Address) Uri(android.net.Uri) Test(org.junit.Test)

Example 85 with Address

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]);
}
Also used : Address(com.fsck.k9.mail.Address) Test(org.junit.Test)

Aggregations

Address (com.fsck.k9.mail.Address)72 Test (org.junit.Test)40 Uri (android.net.Uri)13 RobolectricTest (com.fsck.k9.RobolectricTest)12 Message (com.fsck.k9.mail.Message)10 Date (java.util.Date)8 MimeMessage (com.fsck.k9.mail.internet.MimeMessage)7 ArrayList (java.util.ArrayList)7 MessagingException (com.fsck.k9.mail.MessagingException)6 Contacts (com.fsck.k9.helper.Contacts)5 Recipient (com.fsck.k9.view.RecipientSelectView.Recipient)5 AddressStyle (com.zegoggles.smssync.preferences.AddressStyle)5 IOException (java.io.IOException)5 Intent (android.content.Intent)4 Cursor (android.database.Cursor)4 MatrixCursor (android.database.MatrixCursor)4 AuthenticationFailedException (com.fsck.k9.mail.AuthenticationFailedException)4 CertificateValidationException (com.fsck.k9.mail.CertificateValidationException)4 TextBody (com.fsck.k9.mail.internet.TextBody)4 SpannableString (android.text.SpannableString)3