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
Win a copy of
OCP Oracle Certified Professional Java SE 21 Developer Study Guide: Exam 1Z0-830
this week in the
Programmer Certification
forum!
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
send mail using javamail error
peter qiu
Greenhorn
Posts: 4
posted 22 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
when i send the email using the smtp service i got the exception as " class javax.mail.MessagingException: 505 Error: Client was not authenticated ". I dont' know how to make myself authenticated in the
java
program as to send the mail?
karl koch
Ranch Hand
Posts: 388
posted 22 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
hi
the properties that you pass to the
Session session = Session.getDefaultInstance(props, null); // Define message MimeMessage message = new MimeMessage(session); // set from and to adresses, subject, body.... // ..... // Send message Transport tr = session.getTransport("smtp"); // connect and authenticate tr.connect(host, port, user, pwd); // apply changes, to make authentication work message.saveChanges(); // send the message, USE THIS method. the other // does not work properly tr.sendMessage(message,message.getAllRecipients()); // close the transport tr.close();
the props must contain:
props.put("mail.smtp.auth","true");
along with the other stuff you need there.
hope this helped.
k
peter qiu
Greenhorn
Posts: 4
posted 22 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
hi karl,
Thank you very much for your help! it really works now!
regards
yeah, but ... what would PIE do? Especially concerning this 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
Sending Mail from Ant
Javax.mail.MessagingException
Sending mail through Java
mail authentication
Email impersonating
More...