public class MailviaAPI
extends java.lang.Object
Constructor and Description |
---|
MailviaAPI(java.lang.String recipient,
java.lang.String smtpHost,
int port,
java.lang.String sender,
java.lang.String subject,
java.lang.String user,
java.lang.String password)
Constructs a new mail object.
|
MailviaAPI(java.lang.String recipient,
java.lang.String smtpHost,
int port,
java.lang.String sender,
java.lang.String subject,
java.lang.String user,
java.lang.String password,
java.lang.String smtpSslTrust)
Constructs a new mail object.
|
MailviaAPI(java.lang.String recipient,
java.lang.String smtpHost,
java.lang.String sender,
java.lang.String subject)
Constructs a new mail object with default port (465) and without user authentication.
|
MailviaAPI(java.lang.String recipient,
java.lang.String smtpHost,
java.lang.String sender,
java.lang.String subject,
java.lang.String user,
java.lang.String password)
Constructs a new mail object with default port (465).
|
Modifier and Type | Method and Description |
---|---|
void |
add(boolean emptyLineBefore,
java.lang.String paragraph)
Adds a paragraph to the mail body.
|
void |
add(java.lang.String paragraph)
Adds a paragraph to the mail body.
|
protected void |
addBody(Message message) |
void |
addEmptyLine()
Adds an empty line to the mail body.
|
void |
addRecipient(java.lang.String recipient)
Adds another recipient.
|
void |
addRecipientBCC(java.lang.String bccRecipient)
Adds another BCC recipient.
|
void |
addRecipientCC(java.lang.String ccRecipient)
Adds another CC recipient.
|
boolean |
send()
Sends the mail.
|
void |
sendReturnExc() |
void |
sendReturnExcNew()
Sends the mail.
|
void |
sendReturnExcOldPort25() |
void |
setProtocol(java.lang.String protocol)
Sets the protocol which is "smtps" by default.
|
public MailviaAPI(java.lang.String recipient, java.lang.String smtpHost, java.lang.String sender, java.lang.String subject)
recipient
- the recipient (to)smtpHost
- the SMTP hostsender
- the sender email addresssubject
- the subject of the mailpublic MailviaAPI(java.lang.String recipient, java.lang.String smtpHost, java.lang.String sender, java.lang.String subject, java.lang.String user, java.lang.String password)
recipient
- the recipient (to)smtpHost
- the smtp hostsender
- the sender email addresssubject
- the subject of the mailuser
- the account namepassword
- the account passwordpublic MailviaAPI(java.lang.String recipient, java.lang.String smtpHost, int port, java.lang.String sender, java.lang.String subject, java.lang.String user, java.lang.String password)
recipient
- the recipient (to)smtpHost
- the smtp hostport
- the port of the smtp host to usesender
- the sender email addresssubject
- the subject of the mailuser
- the account namepassword
- the account passwordpublic MailviaAPI(java.lang.String recipient, java.lang.String smtpHost, int port, java.lang.String sender, java.lang.String subject, java.lang.String user, java.lang.String password, java.lang.String smtpSslTrust)
recipient
- the recipient (to)smtpHost
- the smtp hostport
- the port of the smtp host to usesender
- the sender email addresssubject
- the subject of the mailuser
- the account namepassword
- the account passwordsmtpSslTrust
- which SMTP SSL is to trustpublic void setProtocol(java.lang.String protocol)
protocol
- the protocol to usepublic void addRecipient(java.lang.String recipient)
recipient
- the additional recipientpublic void addRecipientCC(java.lang.String ccRecipient)
ccRecipient
- the additional CC recipientpublic void addRecipientBCC(java.lang.String bccRecipient)
bccRecipient
- the additional BCC recipientpublic void addEmptyLine()
public void add(java.lang.String paragraph)
paragraph
- the paragraph to be added to the bodypublic void add(boolean emptyLineBefore, java.lang.String paragraph)
emptyLineBefore
- whether or not there should be an empty line before the paragraphparagraph
- the paragraph to be added to the bodypublic boolean send()
public void sendReturnExc() throws AddressException, MessagingException
AddressException
MessagingException
public void sendReturnExcOldPort25() throws AddressException, MessagingException
AddressException
MessagingException
public void sendReturnExcNew() throws AddressException, MessagingException
AddressException
MessagingException
protected void addBody(Message message) throws MessagingException
MessagingException
Copyright 1998-2023 Christoph Mueller, Kaerntner Str. 56, D-70469 Stuttgart, Germany, https://www.perpus.de