|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Object | +--org.jwarp.service.mail.MailMessage
Creates a very simple text/plain message and sends it.
MailMessage creates a very simple text/plain message and sends
it. It can be used like this:
MailMessage sm = new MailMessage("mail.domain.net",
"toYou@domain.net",
"fromMe@domain",
"this is the subject",
"this is the body");
Another example is:
MailMessage sm = new MailMessage();
sm.setHost("mail.domain.net");
sm.setHeaders("X-Mailer: Sendmail class, X-Priority: 1(Highest)");
sm.setFrom("Net Freak1 user1@domain.com");
sm.setReplyTo("Net Freak8 user8@domain.com");
sm.setTo("Net Freak2 user2@domain.com, Net Freak3 user3@domain.com");
sm.setCc("Net Freak4 user4@domain.com, Net Freak5 user5@domain.com");
sm.setBcc("Net Freak6 user6@domain.com, Net Freak7 user7@domain.com");
sm.setSubject("New Sendmail Test");
sm.setBody("Test message from Sendmail class, more features to be added.
Like multipart messages, html, binary files...");
sm.setDebug(true);
sm.send();
| Field Summary | |
protected org.jwarp.service.mail.InternetAddress[] |
bcc
The email address or addresses that the email is being blind-carbon-copied to. |
protected java.lang.String |
body
The body of the email message. |
protected org.jwarp.service.mail.InternetAddress[] |
cc
The email address or addresses that the email is being carbon-copied to. |
protected boolean |
debug
Displays debug information when true. |
protected org.jwarp.service.mail.InternetAddress |
from
The email address that the mail is being sent from. |
protected java.util.Hashtable |
headers
Used to specify the mail headers. |
protected java.lang.String |
host
The host name of the mail server to use. |
protected org.jwarp.service.mail.InternetAddress[] |
replyTo
The email address used for replies to this message. |
protected java.lang.String |
subject
The subject of the email message. |
protected org.jwarp.service.mail.InternetAddress[] |
to
The email address or addresses that the email is being sent to. |
| Constructor Summary | |
MailMessage()
Default constructor. |
|
MailMessage(java.lang.String h,
java.lang.String t,
java.lang.String f,
java.lang.String s,
java.lang.String b)
Constructor used to specify host, to, from, subject, and body. |
|
MailMessage(java.lang.String h,
java.lang.String t,
java.lang.String c,
java.lang.String bc,
java.lang.String f,
java.lang.String s,
java.lang.String b,
boolean d)
Constructor used to specify host, to, cc, bcc, from, subject, body, and debug. |
|
| Method Summary | |
void |
addHeader(java.lang.String name,
java.lang.String value)
Adds a header (name, value) to the headers Hashtable. |
static org.jwarp.service.mail.InternetAddress[] |
parseAddressField(java.lang.String str)
Parse an address field. |
static org.jwarp.service.mail.InternetAddress[] |
parseAddressList(java.lang.String[] aList)
Parse an address list. |
static void |
parseHeader(java.lang.String str,
java.util.Hashtable headers)
Parse a header. |
static java.util.Hashtable |
parseHeaderField(java.lang.String str)
Parse a header field. |
static java.util.Hashtable |
parseHeaderList(java.lang.String[] hList)
Parse a header list. |
static org.jwarp.service.mail.InternetAddress |
parseInternetAddress(java.lang.String str)
Parse an Internet address. |
static org.jwarp.service.mail.InternetAddress |
parseInternetAddress(java.lang.String address,
java.lang.String personal)
Parse an Internet address. |
boolean |
send()
Send the message. |
void |
setBcc(org.jwarp.service.mail.InternetAddress[] bc)
Used to specify the email address that the mail is being blind-carbon-copied to. |
void |
setBcc(java.lang.String bc)
Used to specify the email address that the mail is being blind-carbon-copied to. |
void |
setBody(java.lang.String b)
Used to specify the body of the email message. |
void |
setCc(org.jwarp.service.mail.InternetAddress[] c)
Used to specify the email address that the mail is being sent to. |
void |
setCc(java.lang.String c)
Used to specify the email address that the mail is being carbon-copied to. |
void |
setDebug(boolean d)
Setting to true will enable the display of debug information. |
void |
setDebug(java.lang.String str)
Setting to true will enable the display of debug information. |
void |
setFrom(org.jwarp.service.mail.InternetAddress f)
Used to specify the email address that the mail is being sent from. |
void |
setFrom(java.lang.String f)
Used to specify the email address that the mail is being sent from. |
void |
setHeaders(java.util.Hashtable h)
Used to specify the mail headers. |
void |
setHeaders(java.lang.String h)
Used to specify the mail headers. |
void |
setHost(java.lang.String h)
Used to specify the mail server host. |
void |
setReplyTo(org.jwarp.service.mail.InternetAddress[] rt)
Used to specify the email address that the mail is being sent from. |
void |
setReplyTo(java.lang.String rp)
Used to specify the email address that the mail is being sent from. |
void |
setSubject(java.lang.String s)
Used to specify the subject of the email message. |
void |
setTo(org.jwarp.service.mail.InternetAddress[] t)
Used to specify the email address that the mail is being sent to. |
void |
setTo(java.lang.String t)
Used to specify the email address that the mail is being sent to. |
| Methods inherited from class java.lang.Object |
|
| Field Detail |
protected java.lang.String host
protected java.util.Hashtable headers
protected org.jwarp.service.mail.InternetAddress from
protected org.jwarp.service.mail.InternetAddress[] replyTo
protected org.jwarp.service.mail.InternetAddress[] to
protected org.jwarp.service.mail.InternetAddress[] cc
protected org.jwarp.service.mail.InternetAddress[] bcc
protected java.lang.String subject
protected java.lang.String body
protected boolean debug
| Constructor Detail |
public MailMessage()
public MailMessage(java.lang.String h,
java.lang.String t,
java.lang.String f,
java.lang.String s,
java.lang.String b)
h - A String with the host.t - A String with the TO.f - A String with the FROM.s - A String with the SUBJECT.b - A String with the BODY.
public MailMessage(java.lang.String h,
java.lang.String t,
java.lang.String c,
java.lang.String bc,
java.lang.String f,
java.lang.String s,
java.lang.String b,
boolean d)
h - A String with the host.t - A String with the TO.c - A String with the CC.bc - A String with the BCC.f - A String with the FROM.s - A String with the SUBJECT.b - A String with the BODY.d - True if debugging is wanted.| Method Detail |
public void addHeader(java.lang.String name,
java.lang.String value)
name - A String with the name.value - A String with the value.public static org.jwarp.service.mail.InternetAddress[] parseAddressField(java.lang.String str)
str - A String with the address.public static org.jwarp.service.mail.InternetAddress[] parseAddressList(java.lang.String[] aList)
aList - A String[] with the addresses.
public static void parseHeader(java.lang.String str,
java.util.Hashtable headers)
str - A String with the header.headers - A Hashtable with the current headers.public static java.util.Hashtable parseHeaderField(java.lang.String str)
str - A String with the header field.public static java.util.Hashtable parseHeaderList(java.lang.String[] hList)
hList - A String[] with the headers.public static org.jwarp.service.mail.InternetAddress parseInternetAddress(java.lang.String str)
str - A String with the address.
public static org.jwarp.service.mail.InternetAddress parseInternetAddress(java.lang.String address,
java.lang.String personal)
address - A String with the address.personal - A String.public boolean send()
public void setBcc(org.jwarp.service.mail.InternetAddress[] bc)
bc - An InternetAddress[].public void setBcc(java.lang.String bc)
bc - A String.public void setBody(java.lang.String b)
b - A String.public void setCc(org.jwarp.service.mail.InternetAddress[] c)
c - An InternetAddress[].public void setCc(java.lang.String c)
c - A String.public void setDebug(java.lang.String str)
str - A String.public void setDebug(boolean d)
d - A boolean.public void setFrom(java.lang.String f)
f - A String.public void setFrom(org.jwarp.service.mail.InternetAddress f)
f - An InternetAddress.public void setHeaders(java.lang.String h)
h - A String.public void setHeaders(java.util.Hashtable h)
h - A Hashtable.public void setHost(java.lang.String h)
h - A String.public void setReplyTo(org.jwarp.service.mail.InternetAddress[] rt)
rt - An InternetAddress[].public void setReplyTo(java.lang.String rp)
rp - A String.public void setSubject(java.lang.String s)
s - A String.public void setTo(org.jwarp.service.mail.InternetAddress[] t)
t - An InternetAddress[].public void setTo(java.lang.String t)
t - A String.
|
|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||