Vishal_donthgavethisresponseon10182000: Invoke (JavaEnterpriseEdition) importjavax. mail. vishal_donth gave this response on 10/18/2000:
// These are the pakages to be imported from
// Java Mail
// The Java Mail PAckage either be dowloaded
// Seperately
// Or else is Available in the J2sdkee1.2
// (Java Enterprise Edition)
Import javax. mail .*;
Import javax. mail. internet .*;
Import java. util .*;
// This function can be used to send the mail
// With the parameters given to it
// U have to specify the smtp server through
// Which u have to send the mail
// Since I was trying with a homenetmail
// Account I directly sent the mail its server
// For sending this mail u need a mail server
// Which lets u to relay the messages
// Try this thing for sending to
// Www.homenetmail.com account because it lets
// U send
// Mails to the accounts like example try
// Sending it to a "abc@homenetmail.com"
// Account. Create the mail account in homenet
// Mail first. If u get any other server which
// Supports relaying u can try this on that
// Also.
// Use this function in ur Servlet to send
// Mail by calling the function with
// Parameters
Public void sendMail (String toAddr, String subject, String body, String fromAddr) throws RemoteException {
Try {
Properties props = new Properties ();
Props. put ("mail. smtp. host", "mail.homenetmail.com ");
// Here we specify the SMTP server through
// Which the mail shocould be delivered
Session session = Session. getDefaultInstance (props, null );
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.