javax.mail.MessagingException: 505 Authentication required
1 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Casey_Ketterling
Posted On:   Wednesday, October 24, 2001 05:15 PM

Our smtp server requires authentication to send mail. Can someone provide some example code to accomodate this? The only snippet I have seen is setting the system props as follows:


			
props.put("mail.smtp.auth", "true");


Thanks,
Casey

Re: javax.mail.MessagingException: 505 Authentication required

Posted By:   Jari_Kanstren  
Posted On:   Thursday, October 25, 2001 01:47 AM

Been meaning to look up on this myself. Here's something that might help you from Suns JavaMail FAQ. Let me know how it turns out for you...

http://java.sun.com/products/javamail/FAQ.html#send


Q: I need to authenticate to my SMTP server so I call trans.connect(host, user, password)and then trans.send(msg)to send the message, but it's not working.
A: You should call msg.saveChanges() and then trans.sendMessage(msg) to send the message.
As described above, the send method is a static convenience method that acquires its own Transport object and creates its own connection to use for sending; it does not use the connection associated with any Transport object through which it is invoked. And of course don't forget to set the mail.smtp.auth property to true to enable SMTP authentication!
About | Sitemap | Contact