Search...
FAQs
Subscribe
Pie
FAQs
Recent topics
Flagged topics
Hot topics
Best topics
Search...
Search within Java API
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:
Other JSE/JEE APIs
can not run simple javamail sample
Alan Hermin
Ranch Hand
Posts: 290
posted 18 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
hi all, where is the problem here?i am developing JavaMail Sample, but got exception
import javax.mail.Message; import javax.mail.MessagingException; import javax.mail.Session; import javax.mail.Transport; import javax.mail.internet.AddressException; import javax.mail.internet.InternetAddress; import javax.mail.internet.MimeMessage; public class SendApp { public static void send(String smtpHost, int smtpPort, String from, String to, String subject, String content) throws AddressException, MessagingException { // Create a mail session java.util.Properties props = new java.util.Properties(); props.put("mail.smtp.host", smtpHost); props.put("mail.smtp.port", ""+smtpPort); Session session = Session.getDefaultInstance(props, null); // Construct the message Message msg = new MimeMessage(session); msg.setFrom(new InternetAddress(from)); msg.setRecipient(Message.RecipientType.TO, new InternetAddress(to)); msg.setSubject(subject); msg.setText(content); // Send the message Transport.send(msg); } public static void main(String[] args) throws Exception { // Send a test message send("smtp.gmail.com", 25, "alaa@yahoo.com", "alaa56mm@gmail.com", "re: dinner", "How about at 7?"); } }
can you help me?please?
[ November 21, 2006: Message edited by: Ala'a Hendi ]
Chetan Parekh
Ranch Hand
Posts: 3640
posted 18 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
Please post your exception here.
My blood is tested +ve for Java.
Alan Hermin
Ranch Hand
Posts: 290
posted 18 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
and this is the exception:
Exception in thread "main" com.sun.mail.smtp.SMTPSendFailedException: 530 5.7.0 Must issue a STARTTLS command first c6sm11740787qbc at com.sun.mail.smtp.SMTPTransport.issueSendCommand(SMTPTransport.java:1388) at com.sun.mail.smtp.SMTPTransport.mailFrom(SMTPTransport.java:959) at com.sun.mail.smtp.SMTPTransport.sendMessage(SMTPTransport.java:583) at javax.mail.Transport.send0(Transport.java:169) at javax.mail.Transport.send(Transport.java:98) at com.mail.SendApp.send(SendApp.java:31) at com.mail.SendApp.main(SendApp.java:36)
Paul Sturrock
Bartender
Posts: 10336
I like...
posted 18 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
An SMTP 530 message means your server requires encryption for the requested authentication mechanism. Speak to your server admin about what is required to connect to their server.
JavaRanch FAQ
HowToAskQuestionsOnJavaRanch
Tuhin Ghosh
Ranch Hand
Posts: 33
posted 18 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
Read this article
http://www.technoids.org/wwstarttls.html
thanks
Tuhin
Evacuate the building! Here, take this tiny ad with you:
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
Need Help in creating a Java Mailer
NoClassDefFoundError JavaMail..........
simple javamail example getting error
Send Mail Error
Javamail error
More...