public class Sendmail
extends java.lang.Object
Mail
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
CRLF
What is an CRLF ?
|
int |
iSentOk
Result of the sending operation.
|
static int |
LINE_MAX_LENGTH
What is the current limit for a line.
|
java.util.List<java.lang.String> |
lInvalidAddresses
Recipient addresses that were rejected by the mail server
|
static int |
SENT_ERROR
The mail could not be sent.
|
static int |
SENT_OK
Everything was ok when sending.
|
static int |
SENT_WARNING
There are some warnings, but the mail was sent.
|
java.lang.String |
sError
Reason of the failure
|
Constructor and Description |
---|
Sendmail(java.lang.String sFrom)
The simplest constructor.
|
Sendmail(java.lang.String sFrom,
java.lang.String sServerAddress)
Constructor used to specify also the server to send this mail through.
|
Sendmail(java.lang.String sFrom,
java.lang.String sServerAddress,
int iServerPort)
Full-options constructor.
|
Modifier and Type | Method and Description |
---|---|
static boolean |
quickSend(Mail m)
Convenience mail for quick sending of emails.
|
boolean |
registerFilter(MailFilter filter)
Register another filter that is to be called before sending each mail
|
boolean |
send(Mail mail)
Send the given mail.
|
void |
setDebug(boolean bDebug)
Enable debugging (printing all lines of the email to the standard error).
|
java.lang.String |
setHELO(java.lang.String s)
Set an override to HELO SMTP command.
|
java.lang.String |
setMAILFROM(java.lang.String s)
Set an override to the MAIL FROM SMTP command.
|
boolean |
unregisterFilter(MailFilter filter)
Unregister a filter
|
public static final int LINE_MAX_LENGTH
public static final int SENT_OK
public static final int SENT_WARNING
public static final int SENT_ERROR
public int iSentOk
public java.lang.String sError
public java.util.List<java.lang.String> lInvalidAddresses
public static final java.lang.String CRLF
public Sendmail(java.lang.String sFrom)
sFrom
- sender email addresspublic Sendmail(java.lang.String sFrom, java.lang.String sServerAddress)
sFrom
- sender mail addresssServerAddress
- server to send the mails throughpublic Sendmail(java.lang.String sFrom, java.lang.String sServerAddress, int iServerPort)
sFrom
- sender mail addresssServerAddress
- server to send the mails throughiServerPort
- server portpublic boolean registerFilter(MailFilter filter)
filter
- public boolean unregisterFilter(MailFilter filter)
filter
- public java.lang.String setHELO(java.lang.String s)
null
value will return to the default behavior.s
- string to send to the SMTP serverpublic java.lang.String setMAILFROM(java.lang.String s)
MailHeader.sReturnPath
, if this is not specified, the "From"
(MailHeader.sFrom
) field.
A value of null
will return the code to the default behavior.s
- email address to give to MAIL FROMpublic void setDebug(boolean bDebug)
bDebug
- debug flagpublic boolean send(Mail mail)
sError
to see what went wrong.mail
- mail to be sentpublic static boolean quickSend(Mail m)
Mail
object.m
- the mail to send. Remember to fill at least MailHeader.sFrom
, MailHeader.sTo
and some Mail.sBody
.