| java.lang.Object uk.org.primrose.SendMail
SendMail | public class SendMail (Code) | | author: Ben Keeping author: Generic sendMail class, allows for sending emails with attachements. |
Inner Class :class SendThread extends Thread | |
Method Summary | |
public void | attach(File file) Add an attachment to the mail (from a file on disk). | public String | nslookup(String domain) Given a domain name like 'hotmail.com', perform an OS nslookup call,
and loop it, looking for the word 'exchanger' in the line. | public void | send() Send a message using the contstructor properties. |
SendMail | public SendMail(Logger logger, String mxServer, String toAddress, String fromAddress, String subject, String text)(Code) | | Construct an email.
If the mxServer is unknown, then the static method SendMail.nslookup() can be called to retrieve the domain's mx server.
Attachments are optional.
Parameters: String - mxServer - The Mail eXchange server to send the mail to. Parameters: String - toAddress - The recipient. Parameters: String - fromAddress - The sender - can be anyting as long as looks like an email address - eg 'me@somewhere.com'. Parameters: String - subject - The mail's subject. Parameters: String - text - The body of the mail. |
attach | public void attach(File file)(Code) | | Add an attachment to the mail (from a file on disk).
Parameters: File - file - the File object to attach. |
nslookup | public String nslookup(String domain)(Code) | | Given a domain name like 'hotmail.com', perform an OS nslookup call,
and loop it, looking for the word 'exchanger' in the line. On Linux and Windoze
the mx mail server is always the last word/token in the line, so set it as such.
This pays no attention to the preference of which mx server to use, but could (and should !)
be built in really. Still, never mind.
Parameters: String - domain - the domain to lookup. |
send | public void send()(Code) | | Send a message using the contstructor properties.
If there is also an attachment to send, add it too.
|
|
|