Skip to content

jimyip/jmail

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

25 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

How to use

  1. To build a simple email.
MimeMessage message = JMail.builder()
        .from("[email protected]")
        .to("[email protected]")
        .subject("Hello world!")
        .text("Hello world!")
        .build();
  1. To build an HTML email.
MimeMessage message = JMail.builder()
        .from("[email protected]")
        .to("[email protected]")
        .subject("Hello world!")
        .html("<span style=\"color:#E53333;\">Hello world!</span>")
        .build();
  1. To build an email with Inline(picture inline)。
String cid = "123456";
MimeMessage message = JMail.builder()
        .from("[email protected]")
        .to("[email protected]")
        .subject("Hello world!")
        .text("Hello world!!")
        .html("<span style=\"color:#E53333;\">Hello world!</span><img src=\"cid:" + cid + "\" alt=\"\" />")
        .addInline(cid, new File("../jmail/picture.jpg"))
        .build();
  1. To build an email with attachment.
MimeMessage message = JMail.builder()
        .from("[email protected]")
        .to("[email protected]")
        .subject("Hello world!")
        .text("Hello world!")
        .html("<span style=\"color:#E53333;\">Hello world!</span>")
        .addAttachment(new File("../jmail/test.txt"))
        .build();
  1. To build an email with inline picture and attachment.
String cid = "123456";
MimeMessage message = JMail.builder()
        .from("[email protected]")
        .to("[email protected]")
        .subject("Hello world!")
        .text("Hello world!")
        .html("<span style=\"color:#E53333;\">Hello world!</span><img src=\"cid:" + cid + "\" alt=\"\" />")
        .addInline(cid, new File("../jmail/picture.jpg"))
        .addAttachment(new File("../jmail/test.txt"))
        .build();

About

simplify javamail

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •  

Languages