IntelliJ Java IDE
The moose likes Servlets and the fly likes sending  emails from  servlet Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Java » Servlets
Reply Bookmark "sending  emails from  servlet" Watch "sending  emails from  servlet" New topic
Author

sending emails from servlet

Nasir Khan
Ranch Hand

Joined: Nov 04, 2000
Posts: 135
HI ,
I'm trying to send an email from servlet using sun.net.smtp.SmtpClient class..
I'm using PostCast server(SMTP server) running on my computer ,The settings are
host name: nasir
server port : 25
Since SmtpClient api is not available I don't know what to put in the constructor.I tried with following but none is working
SmtpClient sc=new SmptClient("nasir:25");
SmtpClient sc=new SmptClient("nasir:2025");
SmtpClient sc=new SmptClient("nasir 2025");
Please help me....
[This message has been edited by Nasir Khan (edited March 14, 2001).]
Angela Lamb
Ranch Hand

Joined: Feb 22, 2001
Posts: 156
The constructor for the class is just SmtpClient(String host). It looks like your host name is wrong. Try putting in your IP address instead.
Nasir Khan
Ranch Hand

Joined: Nov 04, 2000
Posts: 135
Hi Angela,
I tried these
SmtpClient sc=new SmptClient("127.0.0.1:2025");
SmtpClient sc=new SmptClient("http://127.0.0.1:2025");
but still can't make it....
Bhupinder Dhillon
Ranch Hand

Joined: Oct 12, 2000
Posts: 124
Try passing an empty String to the constructor. The localhost should redirect your email automatically.
 
 
subject: sending emails from servlet
 
Threads others viewed
Sending HTML format mail thru JSP
SmtpClient
How to check if a SMTPClient is available or exists?
sun.net.smtp.SmtpClient hanging
use thread to stop application hanging
WebSphere development made easy
without the weight of IBM tools
http://www.myeclipseide.com

cast iron skillet 49er

more from paul wheaton's glorious empire of web junk: cast iron skillet diatomaceous earth rocket mass heater sepp holzer raised garden beds raising chickens lawn care CFL flea control missoula heat permaculture