Java Reference
In-Depth Information
// The Subject
mesg . setSubject ( subject );
// Now the message body.
mesg . setText ( body );
Transport . send ( mesg );
}
/** Convenience method that does it all with one call.
* @param mailhost - SMTP server host
* @param recipient - domain address of email (user@host.domain)
* @param sender - your email address
* @param subject - the subject line
* @param message - the entire message body as a String with embedded \n's
*/
public
public static
void send ( String mailhost ,
String recipient , String sender ,
String subject , String message )
throws
static void
throws MessagingException {
Mailer m = new
new Mailer ();
m . setServer ( mailhost );
m . addTo ( recipient );
m . setFrom ( sender );
m . setSubject ( subject );
m . setBody ( message );
m . doSend ();
}
}
Sending MIME Mail
Problem
You need to send a multipart, MIME-encoded message.
Solution
Use the Part , which is “part” of the JavaMail API.
Search WWH ::




Custom Search