10000 GitHub - jimyip/jmail: simplify javamail
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

jimyip/jmail

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

24 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

How to use

  1. To build a simple email.
MimeMessage message = JMail.builder()
        .from("text@sogou.wiki")
        .to("text2@sogou.wiki")
        .subject("Hello world!")
        .text("Hello world!")
        .build();
  1. To build an HTML email.
MimeMessage message = JMail.builder()
        .from("text@sogou.wiki")
        .to("text2@sogou.wiki")
        .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("text@sogou.wiki")
        .to("text2@sogou.wiki")
        .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("text@sogou.wiki")
        .to("text2@sogou.wiki")
        .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("text@sogou.wiki")
        .to("text2@sogou.wiki")
        .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();
5747

About

simplify javamail

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •  

Languages

0