Package com.axelor.mail
Class MailSender
- java.lang.Object
-
- com.axelor.mail.MailSender
-
public final class MailSender extends Object
TheMailSenderprovides features to send mails.
-
-
Constructor Summary
Constructors Constructor Description MailSender(MailAccount account)Create a newMailSenderwith the given account.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description MailBuildercompose()Compose a new mail message.voidsend(String subject, String text, String... recipients)Send a simple text message to the given recipients.
For better options, usecompose()method to compose a message usingMailBuilderwhich can be retrieved or sent directly withMailBuilder.build()orMailBuilder.send()methods.voidsend(javax.mail.Message message)Send a mail message.
-
-
-
Constructor Detail
-
MailSender
public MailSender(MailAccount account)
Create a newMailSenderwith the given account.- Parameters:
account- the account to use
-
-
Method Detail
-
compose
public MailBuilder compose()
Compose a new mail message.- Returns:
- a
MailBuilderinstance.
-
send
public void send(javax.mail.Message message) throws javax.mail.MessagingExceptionSend a mail message.- Parameters:
message- the message to sent- Throws:
javax.mail.MessagingException- if the message could not be sent- See Also:
Transport.send(Message)
-
send
public void send(String subject, String text, String... recipients) throws javax.mail.MessagingException
Send a simple text message to the given recipients.
For better options, usecompose()method to compose a message usingMailBuilderwhich can be retrieved or sent directly withMailBuilder.build()orMailBuilder.send()methods.- Parameters:
subject- the message subjecttext- the message textrecipients- list of recipients- Throws:
javax.mail.MessagingException- if the message could not be sent
-
-