Skip to content
/ smail Public

small, simple java mailing. mock context included

License

Notifications You must be signed in to change notification settings

hgo/smail

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

smail

small, simple java mailing. mock context included

Usage

// create your global config
MailConfig gmailConfig = new MailConfigBuilder()
  .host("smtp.gmail.com")
  .user(EMAIL_ADDRESS)
  .pass("xxx")
  .channel("starttls")
  .debug(true)
  .protocol("smtp")
  .port(587)
  .mock() // MOCKED
  .build();

// create an email with fluent api
Sendable email = new EmailBuilder()
  .content("Hi guys!")
  .subject("Subject")
  .contentType(EmailConstants.TEXT_PLAIN)
  .from(EMAIL_ADDRESS)
  .recipients(EMAIL_ADDRESS)
  .build();

// and send it
email.send(gmailConfig);


// I build the config with mock()
// So I can get the email from TestMailContext
Email latestEmail = TestMailContext.getLatestEmail(EMAIL_ADDRESS);
assertNotNull(latestEmail);
assertEquals("Subject", latestEmail.getSubject());
String parsedContent = TestMailContext.getParsedContent(latestEmail);
logger.info(parsedContent);
assertEquals("Hi guys?", parsedContent);

About

small, simple java mailing. mock context included

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages