public class SendMail extends Object
Uses SMTP protocol (port 25, or other port set using the setPort method).
Constructor and Description |
---|
SendMail()
Creates a new instance of the SendMail class.
|
Modifier and Type | Method and Description |
---|---|
void |
send()
Send a message.
|
void |
sendError(String toEmail,
String error)
Send an Error message to an email address.
|
void |
setAuthPassword(String password)
Set the authentication password.
|
void |
setAuthUser(String user)
Set the authentication user.
|
void |
setBccEmail(String recipient)
Set the blind carbon copy recipient(s) for this email.
|
void |
setCcEmail(String recipient)
Set the carbon copy recipient(s) for this email.
|
void |
setContentType(String type)
Sets the content type of the message.
|
void |
setDebug(boolean doDebug)
Sets debugging mode.
|
void |
setFromEmail(String sender)
Set the senders email address.
|
void |
setHost(String host)
The SMTP host.
|
void |
setMessageBody(String message)
Set the body of the message.
|
void |
setPort(String port)
Set the port on the host to use.
|
void |
setReplyToEmail(String reply)
Set the Reply To email address(es).
|
void |
setServer(String server)
The server.
|
void |
setSSL()
Set the flag indicating that SSL should be used.
|
void |
setSubject(String subject)
Set the message subject.
|
void |
setToEmail(String recipient)
Set the recipient(s) for this email.
|
void |
setXMailer(String mailer)
Sets the X-mailer string.
|
public void setDebug(boolean doDebug)
public void setXMailer(String mailer)
public void setToEmail(String recipient)
recipient
- A string containing one or more email addresses. If there are more
than one, they must be separated by a comma or semi-colon.public void setCcEmail(String recipient)
recipient
- A string containing one or more email addresses. If there are more
than one, they must be separated by a comma or semi-colon.public void setBccEmail(String recipient)
recipient
- A string containing one or more email addresses. If there are more
than one, they must be separated by a comma or semi-colon.public void setFromEmail(String sender)
This can either be the complete email address, or just the senders id. In the later case it will be combined with the host name to create the complete senders email address.
sender
- The senders email address.public void setReplyToEmail(String reply)
This can either be the complete email address, or just the senders id. In the later case it will be combined with the host name to create the complete senders email address.
reply
- The reply-to email address.public void setServer(String server)
If the senders email address is missing the host, then this host name will be added to the senders email address.
public void setHost(String host)
This will be used for setting the system property "mail.smtp.host". The default value is "mail".
host
- public void setSubject(String subject)
public void setMessageBody(String message)
message
- The mails body.public void setContentType(String type)
The default type is "text/plain".
type
- The new content type.public void setPort(String port)
port
- The host port.public void setAuthUser(String user)
user
- The authentication user.public void setAuthPassword(String password)
password
- The authentication password.public void setSSL()
public void sendError(String toEmail, String error) throws Exception
Exception
Phantom® and NetPhantom® are registered trademarks of Mindus SARL.
© © Mindus SARL, 2024. All rights reserved.