public class MailEngine extends Object
| Constructor and Description |
|---|
MailEngine() |
| Modifier and Type | Method and Description |
|---|---|
org.springframework.mail.MailSender |
getMailSender() |
void |
send(org.springframework.mail.SimpleMailMessage msg)
Send a simple message with pre-populated values.
|
void |
sendMessage(org.springframework.mail.SimpleMailMessage msg,
String templateName,
Map model)
Send a simple message based on a Velocity template.
|
void |
sendMessage(String[] recipients,
String sender,
org.springframework.core.io.ClassPathResource resource,
String bodyText,
String subject,
String attachmentName)
Convenience method for sending messages with attachments.
|
void |
setFrom(String from) |
void |
setMailSender(org.springframework.mail.MailSender mailSender) |
void |
setVelocityEngine(org.apache.velocity.app.VelocityEngine velocityEngine) |
public void setMailSender(org.springframework.mail.MailSender mailSender)
public org.springframework.mail.MailSender getMailSender()
public void setVelocityEngine(org.apache.velocity.app.VelocityEngine velocityEngine)
public void setFrom(String from)
public void sendMessage(org.springframework.mail.SimpleMailMessage msg,
String templateName,
Map model)
msg - the message to populatetemplateName - the Velocity template to use (relative to classpath)model - a map containing key/value pairspublic void send(org.springframework.mail.SimpleMailMessage msg)
throws org.springframework.mail.MailException
msg - the message to sendorg.springframework.mail.MailException - when SMTP server is downpublic void sendMessage(String[] recipients, String sender, org.springframework.core.io.ClassPathResource resource, String bodyText, String subject, String attachmentName) throws javax.mail.MessagingException
recipients - array of e-mail addressessender - e-mail address of senderresource - attachment from classpathbodyText - text in e-mailsubject - subject of e-mailattachmentName - name for attachmentjavax.mail.MessagingException - thrown when can't communicate with SMTP serverCopyright © 2003-2012. All Rights Reserved.