Package com.axelor.mail
Class MailSender
- java.lang.Object
-
- com.axelor.mail.MailSender
-
public final class MailSender extends Object
TheMailSender
provides features to send mails.
-
-
Constructor Summary
Constructors Constructor Description MailSender(MailAccount account)
Create a newMailSender
with the given account.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description MailBuilder
compose()
Compose a new mail message.void
send(String subject, String text, String... recipients)
Send a simple text message to the given recipients.
For better options, usecompose()
method to compose a message usingMailBuilder
which can be retrieved or sent directly withMailBuilder.build()
orMailBuilder.send()
methods.void
send(javax.mail.Message message)
Send a mail message.
-
-
-
Constructor Detail
-
MailSender
public MailSender(MailAccount account)
Create a newMailSender
with the given account.- Parameters:
account
- the account to use
-
-
Method Detail
-
compose
public MailBuilder compose()
Compose a new mail message.- Returns:
- a
MailBuilder
instance.
-
send
public void send(javax.mail.Message message) throws javax.mail.MessagingException
Send 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 usingMailBuilder
which 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
-
-