Wrox Home  
Search P2P Archive for: Go

  Return to Index  

servlets thread: AW: Java Authentication Problem


Message #1 by "Otto Hofmann" <Lukrezian@g...> on Wed, 12 Feb 2003 09:10:18 +0100
I'm not sure but try ...

setPasswordAuthentication() from the Session Object....


I Hope that helps.

Otto


-----Ursprüngliche Nachricht-----
Von: Carlos Arias [mailto:carlos.arias5@v...]
Gesendet: Mittwoch, 12. Februar 2003 08:02
An: Servlets
Betreff: [servlets] Java Authentication Problem


Hi, the hosting company my website is parked is JavaServletHosting.Com
 i'm trying to create an e-mail application in JSP, when i try to send the
mail it gives me an error saying Authentication needed 554.
  i looked around to see if there is any forums or sites i can learn from
but there isn't anything that can help me. This is my code.


 ----------------------------------------------------------------------
<%@ page import="java.util.*, javax.mail.*, javax.mail.internet.*" %>
<%
  Properties props = new Properties();
  props.put("mail.smtp.host", "mail.hosting.com");
  Properties s_props = System.getProperties();
  s_props.put("mail.smtp.auth", "true"); // for sending to external

  Session s = Session.getInstance(props,null);

  MimeMessage message = new MimeMessage(s);
  InternetAddress from = new InternetAddress(webmaster@w...);
  message.setFrom(from);
  InternetAddress to = new InternetAddress("domain@d...");
  message.addRecipient(Message.RecipientType.TO, to);

 //---------------HTML coding in to e-mail starts here -----------//
String htmlmessage = "<html><body><b><center><h4>Testing Authentication
</h4></center></b><br>\n";
htmlmessage += "<DIV><FONT size=2><FONT color=#ff0000><FONT
color=#000000>\n";

  message.setSubject("Subject Goes Here ");
  message.setContent(htmlmessage, "text/html;charset=\"iso-8859-1\"");
  Transport.send(message);
%>
<html>
<p align="center">Thank You For Writing To Me.</p>
<form name="form1" method="post" action="mail.jsp">
</form>
</html>
--------------------------------------------------------------------------


how can i make the application send the username and password to the SMTP
server?
   is there a book or any type of source i can read up on to help me with
this problem.
   I e-mailed my Hosting company they said that they can't disable the
authentication.
  what is it that i am missing?

Thank you for you help
-Carlos




  Return to Index