Skip to content

Latest commit

 

History

History

mailer

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 

Javamail wrapper to send mails

Simple usage:

First create a smtp configuration

	SmtpMailSender smtpSender = new SmtpMailSender();
	smtpSender.setHost("test");
	smtpSender.setPort(123);
	smtpSender.setSender("[email protected]");
	smtpSender.setUseTls(false);

You might want to authorise

	smtpSender.authorize(username, String);

Or use TLS

	smtpSender.setUseTls(true);

Now get the instance of the mail sender using the subject

	MailSender sender = smtpSender.getMailSender("My Test subject");

Set body by type

	sender.addHtmlMailBody("<p>Lorem ipsum Est</p>");
	sender.addTextMailBody("Lorem ipsum Est");

Add whom do you send it

	sender.addRecipient("[email protected]");
	sender.addCopyRecipient("[email protected]");
	sender.addBlindCopyRecipient("[email protected]");

Add attachments

	sender.addAttachement(File file);

Add Custom attachment

	sender.addAttachement(Attachment attachment);

And simply just send

	sender.send();