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
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
paul wheaton
Ron McLeod
Jeanne Boyarsky
Sheriffs:
Paul Clapham
Saloon Keepers:
Tim Holloway
Roland Mueller
Bartenders:
Forum:
Other JSE/JEE APIs
Java Mail API not connecting me from my tomcat server
Farakh khan
Ranch Hand
Posts: 851
posted 14 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
Hello,
public static void send(String from, String to, String subject, String content) throws AddressException, MessagingException { Properties props=new Properties(); props.put("mail.tarassul.sy","localhost"); Session session1 = Session.getDefaultInstance(props,null); Message msg =new MimeMessage(session1); msg.setFrom(new InternetAddress(from)); msg.setRecipients(Message.RecipientType.TO,InternetAddress.parse(to,false)); msg.setSubject(subject); msg.setContent(content,"text/html;charset=\"UTF-8\""); Transport.send(msg); }
ERROR:
Javax.mail.MessagingException: Could not connect to SMTP host: localhost, port: 25;
Thanks & best regards
Lester Burnham
Rancher
Posts: 1337
posted 14 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
Is there a mail server running on that port?
Tomcat
doesn't include one.
Farakh khan
Ranch Hand
Posts: 851
posted 14 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
Lester Burnham wrote:
Is there a mail server running on that port? Tomcat doesn't include one.
No,
Thanks Lester Bunham I fixed it by using authenticator. when am giving login/pass then its work
best regards
We begin by testing your absorbancy by exposing you to this tiny ad:
Clean our rivers and oceans from home
https://www.kickstarter.com/projects/paulwheaton/willow-feeders
reply
reply
Bookmark Topic
Watch Topic
New Topic
Boost this thread!
Similar Threads
Sending Emails
NoClassDefFoundError JavaMail..........
sending mail with JavaMail
javax.mail.internet.AddressException: Missing local name in string
smtp username/password for JavaMail
More...