|
|||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||
java.lang.Object | +--com.precisonline.smtp.SMTPClient
This lightweight class is used for sending email via SMTP from any Java application. It provides a very simple wrapper around the SMTP protocol.
| Field Summary | |
protected boolean |
anonymous
If true, the recipients of the message will be masked by the value of anonymousText. |
protected java.lang.String |
anonymousText
If anonymous is true, the list of message recipients will be masked by the text given here. |
protected java.util.Vector |
bccAddresses
A list of addresses that define those to be blind cc'd on this message. |
protected java.util.Vector |
ccAddresses
A list of addresses that define those to be cc'd on this message. |
protected SMTPAddress |
fromAddress
An address that defines the sender of the message. |
protected java.lang.String |
helloName
The name that this application will use to identify itself when it establishes the connection to the server. |
protected int |
port
The port number where the SMTP server is listening for connections. |
protected int |
priority
The priority of the message. |
protected java.lang.String |
replyMsg
The last message received from the SMTP server. |
protected int |
sensitivity
The sensitivity/confidentiality of the message. |
protected java.lang.String |
server
The name or IP address of an SMTP server who will send the message. |
protected java.lang.String |
subject
The subject line of the message to be sent. |
protected java.lang.String |
text
The text of the message to be sent. |
protected java.util.Vector |
toAddresses
A list of addresses that define where the message is going to. |
| Constructor Summary | |
SMTPClient()
Creates new SMTPClient, connecting to localhost:25, normal priority, normal sensitivity, non-anonymous recipients. |
|
SMTPClient(java.lang.String server,
int port)
Creates new SMTPClient, connecting the the server and port as named. |
|
| Method Summary | |
boolean |
addBccAddress(SMTPAddress address)
Adds a new address to the list of blind-cc addresses. |
boolean |
addBccAddress(java.lang.String address,
java.lang.String name)
Adds a new address to the list of blind-cc addresses. |
boolean |
addCcAddress(SMTPAddress address)
Adds a new address to the list of cc addresses. |
boolean |
addCcAddress(java.lang.String address,
java.lang.String name)
Adds a new address to the list of cc addresses. |
boolean |
addText(java.lang.String text)
Appends new text to the pre-existing message text. |
boolean |
addToAddress(SMTPAddress address)
Adds a new address to the list of recipient addresses. |
boolean |
addToAddress(java.lang.String address,
java.lang.String name)
Adds a new address to the list of recipient addresses. |
java.util.Vector |
getBccAddresses()
Returns the blind-cc addresses assigned to the message. |
java.util.Vector |
getCcAddresses()
Returns the cc addresses assigned to the message. |
SMTPAddress |
getFromAddress()
Returns the address of the message sender. |
java.lang.String |
getSubject()
Returns the subject of the message as set by setSubject(). |
java.lang.String |
getText()
Returns the text of the message. |
java.util.Vector |
getToAddresses()
Returns the addresses of the recipients. |
boolean |
send()
Sends the message to the SMTP server. |
boolean |
setAnonymousRecipients()
If set to true, the list of recipients will be masked by the contents of anonymousText. |
boolean |
setAnonymousText(java.lang.String text)
If setAnonymousRecipients() is used, this method can be used to override the name of the anonymous recipients. |
boolean |
setBccAddresses(java.util.Vector addresses)
Sets the blind-cc addresses for the message. |
boolean |
setCcAddresses(java.util.Vector addresses)
Sets the cc addresses for the message. |
boolean |
setFromAddress(SMTPAddress address)
Sets the address of the sender for the message. |
boolean |
setFromAddress(java.lang.String address,
java.lang.String name)
Sets the address of the sender of the message. |
boolean |
setHelloName(java.lang.String name)
Changes the HELO name used as the first communication in the SMTP protocol. |
boolean |
setPort(int port)
Changes the port number for connecting to the SMTP server. |
boolean |
setPriority(int priority)
Sets the priority of the message. |
boolean |
setSensitivity(int sensitivity)
Sets the sensitivity of the message. |
boolean |
setServer(java.lang.String server)
Changes the name of the SMTP server. |
boolean |
setSubject(java.lang.String subject)
Sets the subject line of the message. |
boolean |
setText(java.lang.String text)
Sets the text of the message. |
boolean |
setToAddresses(java.util.Vector addresses)
Sets the destination addresses for the message. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
protected java.lang.String server
protected java.lang.String helloName
protected java.lang.String subject
protected java.lang.String text
protected java.lang.String anonymousText
protected SMTPAddress fromAddress
protected java.util.Vector toAddresses
protected java.util.Vector ccAddresses
protected java.util.Vector bccAddresses
protected java.lang.String replyMsg
protected int port
protected int priority
protected int sensitivity
protected boolean anonymous
| Constructor Detail |
public SMTPClient()
public SMTPClient(java.lang.String server,
int port)
| Method Detail |
public boolean setServer(java.lang.String server)
public boolean setPort(int port)
public boolean setHelloName(java.lang.String name)
public boolean setFromAddress(SMTPAddress address)
SMTPAddress
public boolean setFromAddress(java.lang.String address,
java.lang.String name)
public boolean setToAddresses(java.util.Vector addresses)
public boolean addToAddress(SMTPAddress address)
public boolean addToAddress(java.lang.String address,
java.lang.String name)
public boolean setCcAddresses(java.util.Vector addresses)
public boolean addCcAddress(SMTPAddress address)
public boolean addCcAddress(java.lang.String address,
java.lang.String name)
public boolean setBccAddresses(java.util.Vector addresses)
public boolean addBccAddress(SMTPAddress address)
public boolean addBccAddress(java.lang.String address,
java.lang.String name)
public boolean setSubject(java.lang.String subject)
public boolean setText(java.lang.String text)
public boolean addText(java.lang.String text)
public boolean setPriority(int priority)
public boolean setSensitivity(int sensitivity)
public boolean setAnonymousRecipients()
public boolean setAnonymousText(java.lang.String text)
public java.lang.String getSubject()
public java.lang.String getText()
public SMTPAddress getFromAddress()
SMTPAddresspublic java.util.Vector getToAddresses()
public java.util.Vector getCcAddresses()
public java.util.Vector getBccAddresses()
public boolean send()
|
|||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||