Skip to content

Commit

Permalink
Changed inline image support to inline resource support.
Browse files Browse the repository at this point in the history
  • Loading branch information
kentcdodds authored and kentcdodds committed Jun 15, 2012
1 parent 7af2399 commit eb8f907
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 5 deletions.
Binary file modified dist/JavaHelper.jar
Binary file not shown.
4 changes: 2 additions & 2 deletions src/com/kentcdodds/javahelper/model/EmailAttachment.java
Original file line number Diff line number Diff line change
Expand Up @@ -99,8 +99,8 @@ public String getContentType() {
* @param contentId
* @throws MessagingException
*/
public void setBodyPartAsInlineImage(String contentId) throws MessagingException {
bodyPart.setHeader("Content-Type", "image/jpeg");
public void setBodyPartAsInlineResource(String contentType, String contentId) throws MessagingException {
bodyPart.setHeader("Content-Type", contentType);
bodyPart.setDisposition(MimeBodyPart.INLINE);
bodyPart.setContentID("<" + contentId + ">");
}
Expand Down
7 changes: 4 additions & 3 deletions src/com/kentcdodds/javahelper/test/TestArchive.java
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@ public static void email() throws MessagingException {
String user = gmailUser;
String password = gmailPassword;
String from = user;
String contentId = "ii_137ecd92681fe047";
String contentId = "image2";
List<String> to = new ArrayList<>();
to.add("me@kentcdodds.com");
List<String> cc = new ArrayList<>();
Expand All @@ -256,10 +256,11 @@ public static void email() throws MessagingException {
email.setHtml(true);
EmailAttachment attachment = new EmailAttachment();
// attachment.setFile(new File("C:\\Users\\kentcdodds\\Documents\\test attachment.txt"));
attachment.setFile(new File("C:\\Users\\kentcdodds\\Downloads\\smileyfacerd1.jpg"));
// attachment.setFile(new File("C:\\Users\\kentcdodds\\Downloads\\smileyfacerd1.jpg"));
attachment.setFile(new File("C:\\Users\\kentcdodds\\Downloads\\CrystalReportViewer.pdf"));
// attachment.setFile(new File(ioPlaygroundDir, "I am a print test.txt"));
attachment.generateMimeBodyPart();
attachment.setBodyPartAsInlineImage(contentId);
attachment.setBodyPartAsInlineResource("application/pdf", contentId);
email.addEmailAttachment(attachment);
email.addReplyTo("kentdoddsproductions@gmail.com", "kentcdodds@gmail.com");
// Session session = Session.getInstance(mailServerProperties, null);
Expand Down
Binary file modified store/JavaHelper.jar
Binary file not shown.

0 comments on commit eb8f907

Please sign in to comment.