Hello,

I have seen many postings about sending an email from a servlet, I did that and
it worked fine, here is what I did:

- Make sure you have mail.jar (Java mail package) and activation.jar (Java
Activation Framework package) in your ClassPath and in the servlet enginer
class path.

- you can use the following code:

            Properties prop = Systems.getProperties();
            prop.put("mail.smtp.host", yourSMTPHost);
            Session s = Session.getInstance(prop, null);
            MimeMessage message = new MimeMessage(s);
            message.setFrom( ...
            message.addRecipient(...
            message.setSubject(...
            message.setText(...
            Transposrt.send(message);

Another way is to open a TCP socket connection at SMTP port of your SMTP
server.

regards,
Nabil

R MUTHUSWAMY wrote:

> hi guys,
>         i have a servlet which is supposed to send a mail, which iam doing
> using the socket opening and sending, the mail is going through the
> normal application, but if i use the logic for the servlet the mail is not
> being sent, can anybody show some light on it,
>
> Thanx in advance,
> -muthu.
>
> ___________________________________________________________________________
> To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
> of the message "signoff SERVLET-INTEREST".
>
> Archives: http://archives.java.sun.com/archives/servlet-interest.html
> Resources: http://java.sun.com/products/servlet/external-resources.html
> LISTSERV Help: http://www.lsoft.com/manuals/user/user.html

___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".

Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html

Reply via email to