A friendly place for programming greenhorns!
Big Moose Saloon
Register / Login
Win a copy of
OCA Java SE 8 Programmer I Study Guide 1Z0-808
this week in the
Other JSE/JEE APIs
imap javamail help
Joined: Sep 09, 2004
Jan 17, 2005 13:41:00
I decided it would be easier to use IMAP, since I'm only interested in sending emails. My
program is shown below, am pretty sure somethings wrong...I just dont know what. I get the following error:
: Connection timed out: connect
Heres the code:
<%@page import=" java.util.*, javax.mail.*, javax.mail.internet.*"%> <% Properties props = new Properties(); props.put ("mail.imap.host", "imap-J.le.ac.uk "); Session s = Session.getInstance(props); MimeMessage message = new MimeMessage(s); InternetAddress from = new InternetAddress("BA@le.ac.uk"); message.setFrom(from); InternetAddress to = new InternetAddress("email@example.com"); message.addRecipient(Message.RecipientType.TO,to); message.setSubject("test from javamail"); message.setText("Hello from javamail"); Store store = s.getStore("imap"); store.connect("smtp.ntlworld.com","myusername","mypassword"); Transport.send(message); store.close(); // Transport t = s.getTransport("smtp"); // t.connect("smtp.ntlworld.com","firstname.lastname@example.org","r068813135"); // t.send(message); //t.close(); %> <html> <body> <p align = "centre"> Mail has been sent </body> </html>
I'm in desperate need for this to work....somebody please help.
Joined: Sep 09, 2004
Jan 17, 2005 13:46:00
I think the line:
Store store = s.getStore("imap");
Store store = s.getStore("pop3");
but now I get these two errors at different times...
: [IN-USE] account is locked by another session or for maintenance, try again.
: Could not connect to SMTP host: localhost, port: 25;
Did you see how Paul
cut 87% off of his electric heat bill with 82 watts of micro heaters
subject: imap javamail help
javamail jsp problem
Javamail interface error
Mail variables are not being resolved to a type !
Java Mail - How to send to Multiple recipients
All times are in JavaRanch time: GMT-6 in summer, GMT-7 in winter
| Powered by
Copyright © 1998-2015