Search...
FAQs
Subscribe
Pie
FAQs
Recent topics
Flagged topics
Hot topics
Best topics
Search...
Search within Java in General
Search Coderanch
Advance search
Google search
Register / Login
Post Reply
Bookmark Topic
Watch Topic
New Topic
programming forums
Java
Mobile
Certification
Databases
Caching
Books
Engineering
Micro Controllers
OS
Languages
Paradigms
IDEs
Build Tools
Frameworks
Application Servers
Open Source
This Site
Careers
Other
Pie Elite
all forums
this forum made possible by our volunteer staff, including ...
Marshals:
Campbell Ritchie
Tim Cooke
Liutauras Vilda
Jeanne Boyarsky
paul wheaton
Sheriffs:
Ron McLeod
Devaka Cooray
Henry Wong
Saloon Keepers:
Tim Holloway
Stephan van Hulst
Carey Brown
Tim Moores
Mikalai Zaikin
Bartenders:
Frits Walraven
Forum:
Java in General
javax.mail.AuthenticationFailedException: 535 5.7.8 Error: authentication failed: authentication fai
Santhosh Samban
Greenhorn
Posts: 9
I like...
posted 9 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
I am having a program to send mail as follows:
I am giving user name and password correctly. I checked it with sending mail from browser and it is working
import java.util.Properties; import javax.mail.Message; import javax.mail.MessagingException; import javax.mail.PasswordAuthentication; import javax.mail.Session; import javax.mail.Transport; import javax.mail.internet.InternetAddress; import javax.mail.internet.MimeMessage; public class sendMail { String toMail = ""; String frmMail = ""; String frmPass = ""; String subj = ""; String body = ""; public sendMail(String toMail, String frmMail, String frmPass, String subj, String body) { this.toMail = toMail; this.frmMail = frmMail; this.frmPass = frmPass; this.subj = subj; this.body = body; } public String mailProcess() { String mailProcessed = ""; Properties props = new Properties(); props.put("mail.smtp.host", "smtp.bizmail.yahoo.com"); props.put("mail.smtp.socketFactory.port", "465"); props.put("mail.smtp.socketFactory.class", "javax.net.ssl.SSLSocketFactory"); props.put("mail.smtp.auth", "true"); props.put("mail.smtp.port", "465"); Session session = Session.getDefaultInstance(props, new javax.mail.Authenticator() { protected PasswordAuthentication getPasswordAuthentication() { return new PasswordAuthentication(frmMail, frmPass); } }); try { Message message = new MimeMessage(session); message.setFrom(new InternetAddress(frmMail)); message.setRecipients(Message.RecipientType.TO, InternetAddress.parse(toMail)); message.setSubject(subj); message.setText(body); Transport.send(message); //System.out.println("Done"); mailProcessed = "true"; } catch (MessagingException e) { mailProcessed = e.toString(); //throw new RuntimeException(e); } return mailProcessed; } }
But I am getting the following error:
javax.mail.AuthenticationFailedException: 535 5.7.8 Error: authentication failed: authentication failure
Please help guys!!
See ya later boys, I think I'm in love. Oh wait, she's just a tiny ad:
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
reply
Bookmark Topic
Watch Topic
New Topic
Boost this thread!
Similar Threads
How to configure localhost to send email.
Sending mail through Java
SHA1 digest error for javax/mail/MessagingException
JavaMail, servlet error
email sending code is not working in servlet
More...