Results 1 to 3 of 3
Thread: javax.mail
- 03-17-2011, 03:35 PM #1
Member
- Join Date
- Feb 2011
- Location
- Spain
- Posts
- 26
- Rep Power
- 0
javax.mail
Hi all.
I have a problem related with javax.mail and an exchange server.
Once the program gets the line of Transport.send(message), i have no response nor exception.
I've also checked with tcpview for Win that the connection with the server is established. This is my code:
Java Code:public class MailExample { public static void main(String[] args) throws MessagingException { new MailExample().run(); } private void run() throws MessagingException { Message message = new MimeMessage(getSession()); message.addRecipient(RecipientType.TO, new InternetAddress("xxxx@xxxx.com")); message.addFrom(new InternetAddress[] { new InternetAddress("xxxx@xxxx.com") }); message.setSubject("the subject"); message.setContent("the body", "text/plain"); Transport.send(message); System.out.println ("Mensaje enviado con éxito"); } private Session getSession() { Authenticator authenticator = new Authenticator(); Properties properties = new Properties(); properties.setProperty("mail.smtp.submitter", authenticator.getPasswordAuthentication().getUserName()); properties.setProperty("mail.smtp.auth", "true"); properties.setProperty("mail.smtp.host", "xxxxxxx.central.xxxxxx.xxxxxx"); properties.setProperty("mail.smtp.port", "7190"); properties.setProperty("mail.smtp.user", "xxxxxx"); return Session.getInstance(properties, authenticator); } private class Authenticator extends javax.mail.Authenticator { private PasswordAuthentication authentication; public Authenticator() { String username = "CENTRAL\\xxxxxxxx"; String password = "xxxxxxx"; authentication = new PasswordAuthentication(username, password); } protected PasswordAuthentication getPasswordAuthentication() { return authentication; } } }
Any ideas?
Thanks in advance!
- 03-17-2011, 05:46 PM #2
Member
- Join Date
- Feb 2011
- Location
- Spain
- Posts
- 26
- Rep Power
- 0
the problem was in the server side.
Now the program is running.
- 06-08-2011, 11:37 AM #3
Member
- Join Date
- Jun 2011
- Posts
- 1
- Rep Power
- 0
Hello I have a similar issue, however, I do get a bit further. When I call transport.send() I get the following exception "javax.mail.AuthenticationFailedException: failed to connect, no password specified?" I have specified a user and password. I see the same as part of the debug output, which is enabled via session.setDebug(true) and mail.debug=true in the properties file. I have tried many gyrations to transmit mail with no success.
Thanks,
John
Similar Threads
-
javax.mail Query HELP
By ravjot28 in forum NetworkingReplies: 2Last Post: 01-22-2010, 01:16 PM -
problem with sending mail usin javaX.mail api
By sandeepsai39 in forum New To JavaReplies: 4Last Post: 11-25-2009, 05:37 AM -
javax.mail.Transport
By sharpi03 in forum Advanced JavaReplies: 5Last Post: 10-23-2009, 05:26 PM -
Javax.mail.MethodNotSupported Exception in java mail api
By namarc in forum Advanced JavaReplies: 2Last Post: 05-05-2008, 06:01 AM -
I can't import javax.mail
By katie in forum New To JavaReplies: 2Last Post: 08-04-2007, 05:05 PM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks