|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--com.javaranch.common.Email
Emails a message to a user.
This class provides a central place for eliminating redundant email code.
Define your SMTP server once, and all future emails use that server.
- - - - - - - - - - - - - - - - -
Copyright (c) 1999-2004 Paul Wheaton
Copyright (c) 1999-2000 EarthWatch, Inc. You are welcome to do whatever you want to with this source file provided that you maintain this comment fragment (between the dashed lines). Modify it, change the package name, change the class name ... personal or business use ... sell it, share it ... add a copyright for the portions you add ...
My goal in giving this away and maintaining the copyright is to hopefully direct developers back to JavaRanch.
I originally developed this class while working as a contractor at EarthWatch, Inc. in Longmont, Colorado. They gave me permission to distribute this code this way provided that their message would also be carried along. Their message is that they hire Java programmers and would like you to consider working with them. I have to say that my experience with them was first rate and I would encourage engineers to work there. Check out their web site at http://www.digitalglobe.com.
The original source can be found at JavaRanch
- - - - - - - - - - - - - - - - -
Field Summary | |
static java.lang.String |
smtpServerKey
|
Constructor Summary | |
Email()
|
Method Summary | |
static java.lang.String |
getAdminEmail()
|
static void |
reportError(java.lang.String message)
Send an e-mail to the admin, from the admin defined by the setAdminEmail() method via the specified server defined via the setSMTPServer() method. |
static void |
send(java.lang.String from,
java.lang.String body)
Send an e-mail to the admin defined by the setAdminEmail() method and the server defined via the setSMTPServer() method. |
static void |
send(java.lang.String to,
java.lang.String from,
java.lang.String subject,
java.lang.String body)
SMTP server must be defined via the setSMTPServer() method before you can use this method. |
static void |
setAdminEmail(java.lang.String adminEmail)
|
static void |
setSMTPServer(java.lang.String smtpServer)
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final java.lang.String smtpServerKey
Constructor Detail |
public Email()
Method Detail |
public static void setSMTPServer(java.lang.String smtpServer)
smtpServer
- for example, "192.168.1.1", "mail.megacorp.com", "127.0.0.1", etc.public static java.lang.String getAdminEmail()
public static void setAdminEmail(java.lang.String adminEmail)
public static void send(java.lang.String to, java.lang.String from, java.lang.String subject, java.lang.String body) throws java.lang.Exception
java.lang.Exception
public static void send(java.lang.String from, java.lang.String body) throws java.lang.Exception
java.lang.Exception
public static void reportError(java.lang.String message)
If there are any problems, write the problem to the System.err.
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |