javax.mail.AuthenticationFailedException Error
1 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Arun_Singh
Posted On:   Sunday, May 4, 2008 12:25 AM

I am working on a site . In that there is an option for sending the mail . But i got javax.mail.AuthenticationFailedException when i send the mail. But it works sometimes and it fails sometimes automaticallly. I am sure that there i sno problem in my mailing code. I contacted the person which provide the webhosting service for the my wesite. He said it is the problem from your side . I am in confusion . what is the problem . I do not use any user id and password My code is import javax.mail.internet.*; import javax.activation.*; import java.util.Properties;    More>>

I am working on a site . In that there is an option for sending the mail .



But i got javax.mail.AuthenticationFailedException when i
send the mail.



But it works sometimes and it fails sometimes
automaticallly.


I am sure that there i sno problem in my mailing code.
I contacted the person which provide the webhosting service for the my wesite.


He said it is the problem from your side . I am in confusion . what is the problem . I do not use any user id and password



My code is




import javax.mail.internet.*;

import javax.activation.*;

import java.util.Properties;

import sun.net.smtp.SmtpClient;




public class SendMailBean
{

String smtpHost = "localhost";

String contenttype = "text/plain";

public String send(String p_from, String p_to, String

p_cc, String p_bcc, String p_subject, String p_message,

String p_smtpServer, String contenttype)

{


try

{

if(contenttype!=null)

{

this.contenttype = contenttype;

}




Properties prop = System.getProperties();

prop.put("mail.smtp.host",smtpHost);

Session ses = Session.getInstance(prop,null);

MimeMessage message = new MimeMessage(ses);

message.setFrom(new InternetAddress(p_from));

message.setRecipient(Message.RecipientType.TO,new

InternetAddress(p_to));

if(p_cc != null)

{

message.setRecipient(Message.RecipientType.CC,new

InternetAddress(p_cc));

}

if(p_bcc != null)

{

message.setRecipient(Message.RecipientType.BCC,new

InternetAddress(p_bcc));

}

message.setSubject(p_subject);

message.setContent(p_message,this.contenttype);

Transport.send(message);

return "success";

}

catch(Exception e)

{

return e.toString();

}

}

}

   <<Less

Re: javax.mail.AuthenticationFailedException Error

Posted By:   Christopher_Koenigsberg  
Posted On:   Sunday, May 4, 2008 04:40 PM

It would be very disturbing if your ISP really allowed your web application to be randomly used by anyone on the web, to send out mail to any destination address, from any purported sender address, with no kind of authentication....
About | Sitemap | Contact