Skip to content

Commit

Permalink
#30 Better demonstration test class - fixed naming issue
Browse files Browse the repository at this point in the history
  • Loading branch information
bbottema committed Feb 25, 2016
1 parent 7faefe9 commit 4c67706
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/main/java/MailTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,14 @@ public static void main(final String[] args) throws IOException, MessagingExcept
// don't forget to add your own address here ->
emailNormal.addRecipient("C.Cane", "candycane@candyshop.org", RecipientType.TO);
emailNormal.setText("We should meet up!");
emailNormal.setTextHTML("<b>We should meet up!</b><img src='cid:winksmiley'>");
emailNormal.setTextHTML("<b>We should meet up!</b><img src='cid:thumbsup'>");
emailNormal.setSubject("hey");

// add two text files in different ways and a black thumbs up embedded image ->
emailNormal.addAttachment("dresscode.txt", new ByteArrayDataSource("Black Tie Optional", "text/plain"));
emailNormal.addAttachment("location.txt", "On the moon!".getBytes(), "text/plain");
String base64String = "iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAABeElEQVRYw2NgoAAYGxu3GxkZ7TY1NZVloDcAWq4MxH+B+D8Qv3FwcOCgtwM6oJaDMTAUXOhmuYqKCjvQ0pdoDrCnmwNMTEwakC0H4u8GBgYC9Ap6DSD+iewAoIPm0ctyLqBlp9F8/x+YE4zpYT8T0LL16JYD8U26+B7oyz4sloPwenpYno3DchCeROsUbwa05A8eB3wB4kqgIxOAuArIng7EW4H4EhC/B+JXQLwDaI4ryZaDSjeg5mt4LCcFXyIn1fdSyXJQVt1OtMWGhoai0OD8T0W8GohZifE1PxD/o7LlsPLiFNAKRrwOABWptLAcqc6QGDAHQEOAYaAc8BNotsJAOgAUAosG1AFA/AtUoY3YEFhKMAvS2AE7iC1+WaG1H6gY3gzE36hUFJ8mqzbU1dUVBBqQBzTgIDQRkWo5qCZdpaenJ0Zx1aytrc0DDB0foIG1oAYKqC0IZK8D4n1AfA6IzwPxXpCFoGoZVEUDaRGGUTAKRgEeAAA2eGJC+ETCiAAAAABJRU5ErkJggg==";
emailNormal.addEmbeddedImage("winksmiley", Base64.getDecoder().decode(base64String), "image/png");
emailNormal.addEmbeddedImage("thumbsup", Base64.getDecoder().decode(base64String), "image/png");

// let's try producing and then consuming a MimeMessage ->
final MimeMessage mimeMessage = Mailer.produceMimeMessage(emailNormal, Session.getDefaultInstance(new Properties()));
Expand Down

0 comments on commit 4c67706

Please sign in to comment.