use of org.simplejavamail.api.email.Email in project simple-java-mail by bbottema.
the class EmailPopulatingBuilderImpl1Test method testEmbeddingImagesWithDynamicDataSourceResolution_relativeFilePathWithBasedir.
@Test
public void testEmbeddingImagesWithDynamicDataSourceResolution_relativeFilePathWithBasedir() throws IOException {
final Email email = builder.withEmbeddedImageAutoResolutionForFiles(true).withEmbeddedImageAutoResolutionForClassPathResources(true).withEmbeddedImageAutoResolutionForURLs(true).withEmbeddedImageBaseDir(RESOURCES_PATH).withHTMLText("<img src=\"cid:cid_name\"/>").appendTextHTML("<img src=\"pkcs12/about all this.txt\"/>").buildEmail();
verifyEmbeddedImage(email, "to generate CA cert, private key and and S/MIME format");
}
use of org.simplejavamail.api.email.Email in project simple-java-mail by bbottema.
the class EmailPopulatingBuilderImpl1Test method testBuilderFromAddressOverwriteWithAlternativeBuilderMethod.
@Test
public void testBuilderFromAddressOverwriteWithAlternativeBuilderMethod() {
final Email email = builder.from("lollypop", // should be overwritted
"lol.pop@somemail.com").from(new Recipient("lollypop2", "lol.pop2@somemail.com", null)).buildEmail();
assertThat(email.getFromRecipient().getName()).isEqualTo("lollypop2");
assertThat(email.getFromRecipient().getAddress()).isEqualTo("lol.pop2@somemail.com");
assertThat(email.getFromRecipient().getType()).isNull();
}
use of org.simplejavamail.api.email.Email in project simple-java-mail by bbottema.
the class EmailPopulatingBuilderImpl1Test method testEmbeddingImagesWithDynamicDataSourceResolution_absoluteFilePathOutsideBasedir_AllowedTrue.
@Test
public void testEmbeddingImagesWithDynamicDataSourceResolution_absoluteFilePathOutsideBasedir_AllowedTrue() throws IOException {
final Email email = builder.withEmbeddedImageAutoResolutionForFiles(true).withEmbeddedImageAutoResolutionForClassPathResources(true).withEmbeddedImageAutoResolutionForURLs(true).withEmbeddedImageBaseDir(RESOURCES_PATH + "/pkcs12").allowingEmbeddedImageOutsideBaseDir(true).withHTMLText("<img src=\"cid:cid_name\"/>").appendTextHTML("<img src=\"" + RESOURCES_PATH + "/log4j2.xml\"/>").buildEmail();
verifyEmbeddedImage(email, "<Console name=\"console\" target=\"SYSTEM_OUT\">");
}
use of org.simplejavamail.api.email.Email in project simple-java-mail by bbottema.
the class EmailPopulatingBuilderImpl1Test method testBuilderFromAddress.
@Test
public void testBuilderFromAddress() {
final Email email = builder.from(new Recipient("lollypop", "lol.pop@somemail.com", null)).buildEmail();
assertThat(email.getFromRecipient().getName()).isEqualTo("lollypop");
assertThat(email.getFromRecipient().getAddress()).isEqualTo("lol.pop@somemail.com");
assertThat(email.getFromRecipient().getType()).isNull();
}
use of org.simplejavamail.api.email.Email in project simple-java-mail by bbottema.
the class EmailPopulatingBuilderImpl1Test method testPrependText_ToEmptyText.
@Test
public void testPrependText_ToEmptyText() {
Email test = builder.prependText("test").buildEmail();
EmailAssert.assertThat(test).hasPlainText("test");
}
Aggregations