Search in sources :

Example 21 with MailMessageImpl

use of com.outjected.email.impl.MailMessageImpl in project simple-email by codylerum.

the class InternetAddressTest method validAddresses.

@Test
public void validAddresses() {
    MailMessage m = new MailMessageImpl(TestMailConfigs.standardConfig());
    BasicEmailContact seam = new BasicEmailContact("seam@domain.test");
    BasicEmailContact seamey = new BasicEmailContact("seamey@domain.test");
    Collection<EmailContact> addresses = new ArrayList<EmailContact>();
    addresses.add(seamey);
    m.from("Seam Seamerson<seam@domain.test>");
    m.from("seam@domain.test");
    m.from(seam);
    m.to("seam@domain.test", "Seam Seamerson<seam@domain.test>");
    m.to("Seam Seamerson<seam@domain.test>");
    m.to("seam@domain.test");
    m.to(seam);
    m.to(addresses);
    m.cc("seam@domain.test", "Seam Seamerson<seam@domain.test>");
    m.cc("Seam Seamerson<seam@domain.test>");
    m.cc("seam@domain.test");
    m.cc(seam);
    m.cc(addresses);
    m.bcc("seam@domain.test", "Seam Seamerson<seam@domain.test>");
    m.bcc("Seam Seamerson<seam@domain.test>");
    m.bcc("seam@domain.test");
    m.bcc(seam);
    m.bcc(addresses);
    m.replyTo("Seam Seamerson<seam@domain.test>");
    m.replyTo("seam@domain.test");
    m.replyTo(seam);
}
Also used : MailMessage(com.outjected.email.api.MailMessage) MailMessageImpl(com.outjected.email.impl.MailMessageImpl) EmailContact(com.outjected.email.api.EmailContact) BasicEmailContact(com.outjected.email.impl.BasicEmailContact) ArrayList(java.util.ArrayList) BasicEmailContact(com.outjected.email.impl.BasicEmailContact) Test(org.junit.Test)

Example 22 with MailMessageImpl

use of com.outjected.email.impl.MailMessageImpl in project simple-email by codylerum.

the class InternetAddressTest method invalidToFullAddresses.

@Test(expected = InvalidAddressException.class)
public void invalidToFullAddresses() {
    MailMessage m = new MailMessageImpl(TestMailConfigs.standardConfig());
    m.to("foo @bar.com", "Woo");
}
Also used : MailMessage(com.outjected.email.api.MailMessage) MailMessageImpl(com.outjected.email.impl.MailMessageImpl) Test(org.junit.Test)

Example 23 with MailMessageImpl

use of com.outjected.email.impl.MailMessageImpl in project simple-email by codylerum.

the class InternetAddressTest method invalidCcSimpleAddresses.

@Test(expected = InvalidAddressException.class)
public void invalidCcSimpleAddresses() {
    MailMessage m = new MailMessageImpl(TestMailConfigs.standardConfig());
    m.cc("woo foo @bar.com");
}
Also used : MailMessage(com.outjected.email.api.MailMessage) MailMessageImpl(com.outjected.email.impl.MailMessageImpl) Test(org.junit.Test)

Example 24 with MailMessageImpl

use of com.outjected.email.impl.MailMessageImpl in project simple-email by codylerum.

the class InternetAddressTest method invalidFromFullAddresses.

@Test(expected = InvalidAddressException.class)
public void invalidFromFullAddresses() {
    MailMessage m = new MailMessageImpl(TestMailConfigs.standardConfig());
    m.from("Woo");
}
Also used : MailMessage(com.outjected.email.api.MailMessage) MailMessageImpl(com.outjected.email.impl.MailMessageImpl) Test(org.junit.Test)

Example 25 with MailMessageImpl

use of com.outjected.email.impl.MailMessageImpl in project simple-email by codylerum.

the class InternetAddressTest method invalidCcFullAddresses.

@Test(expected = InvalidAddressException.class)
public void invalidCcFullAddresses() {
    MailMessage m = new MailMessageImpl(TestMailConfigs.standardConfig());
    m.cc("foo @bar.com", "Woo");
}
Also used : MailMessage(com.outjected.email.api.MailMessage) MailMessageImpl(com.outjected.email.impl.MailMessageImpl) Test(org.junit.Test)

Aggregations

MailMessageImpl (com.outjected.email.impl.MailMessageImpl)34 Test (org.junit.Test)34 Wiser (org.subethamail.wiser.Wiser)21 SessionConfig (com.outjected.email.api.SessionConfig)20 EmailMessage (com.outjected.email.api.EmailMessage)17 MimeMessage (javax.mail.internet.MimeMessage)17 BodyPart (javax.mail.BodyPart)15 MimeMultipart (javax.mail.internet.MimeMultipart)15 MailMessage (com.outjected.email.api.MailMessage)13 URLAttachment (com.outjected.email.impl.attachments.URLAttachment)8 FreeMarkerTemplate (com.outjected.email.impl.templating.freemarker.FreeMarkerTemplate)6 VelocityTemplate (com.outjected.email.impl.templating.velocity.VelocityTemplate)6 SMTPAuthenticator (com.outjected.email.util.SMTPAuthenticator)2 EasyAuthenticationHandlerFactory (org.subethamail.smtp.auth.EasyAuthenticationHandlerFactory)2 EmailContact (com.outjected.email.api.EmailContact)1 BasicEmailContact (com.outjected.email.impl.BasicEmailContact)1 SimpleMailConfig (com.outjected.email.impl.SimpleMailConfig)1 ArrayList (java.util.ArrayList)1