wood burning stoves 2.0*
The moose likes Servlets and the fly likes Can we send Mail as response to a request? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "Can we send Mail as response to a request?" Watch "Can we send Mail as response to a request?" New topic

Can we send Mail as response to a request?

sajan goel

Joined: Aug 01, 2007
Posts: 7
using servlets can we send response to a particular mail id for a specific request?

if yes somebody please tell me how to do this
Adeel Ansari
Ranch Hand

Joined: Aug 15, 2004
Posts: 2874
Yes, why not. But don't forget it is good to respond the requesting user, at least a 200 message as a response.

It should go like

1. receive request
2. manipulate it
3. create email message
4. send the email
5. fabricate the response
6. send the response to the original sender of the request

Hope you got it.
Ulf Dittmer

Joined: Mar 22, 2005
Posts: 41019
Just to make it perfectly clear, the mail would be in response to the HTTP request, it would not be the response (which must be HTTP, obviously).

You'd need a mail server (or at least an SMTP server), and then you can use the JavaMail API to send mails. The http://faq.javaranch.com/java/JavaEnterpriseEditionFaq page contains many useful links regarding JavaMail, including extensive tutorials and sample code.

Ping & DNS - my free Android networking tools app
I agree. Here's the link: http://aspose.com/file-tools
subject: Can we send Mail as response to a request?
Similar Threads
about sending request
UrlConnections versus HttpURLConnection versus Apaches HttpClient
Is SCBCD has expire date.
Sending response to client with out receving request