smtp over ssl fails with JavaMail API

Hi!

I?m a novice in Java and I?m going crazy...

I?m setting following properties:
-------------------------------------------
props.put("mail.transport.protocol", "smtps"); 
props.put("mail.smtps.host", host); 
props.put("mail.smtps.user", from); 
props.put("mail.smtps.port", port_str); 
props.put("mail.smtps.auth", auth);
----

I?m trying to send the with:
----------------------------------
Authenticator au = new MyAuthenticator();
Session session = Session.getInstance(props, au)

Transport trans = session.getTransport(); 
trans.connect(host, port_i, from, pass); 
trans.send(msg);
--------------

However i?m always getting the following error-message:
-----------------------------------------------------------
DEBUG: setDebug: JavaMail version 1.3.2
DEBUG: getProvider() returning javax.mail.Provider [TRANSPORT,smtps,com.sun.mail.smtp.SMTPSSLTranspor
t,Sun Microsystems, Inc]
DEBUG SMTP: useEhlo true, useAuth true
DEBUG SMTP: trying to connect to host "mail.gmx.net", port 465, isSSL true 220 {mp016} GMX Mailservices ESMTP DEBUG SMTP: connected to host "mail.gmx.net", port: 465

EHLO toshm30x
250-{mp016} GMX Mailservices
250-8BITMIME
250-ENHANCEDSTATUSCODES
250-AUTH=LOGIN CRAM-MD5 PLAIN
250-AUTH CRAM-MD5 LOGIN PLAIN
250 STARTTLS
DEBUG SMTP: Found extension "8BITMIME", arg ""
DEBUG SMTP: Found extension "ENHANCEDSTATUSCODES", arg ""
DEBUG SMTP: Found extension "AUTH=LOGIN", arg "CRAM-MD5 PLAIN"
DEBUG SMTP: Found extension "AUTH", arg "CRAM-MD5 LOGIN PLAIN"
DEBUG SMTP: Found extension "STARTTLS", arg ""
DEBUG SMTP: Attempt to authenticate
AUTH LOGIN
334 VXNlcm5hbWU6
Y2VsYWwua2FyYWthc0BnbXguZGU=
334 UGFzc3dvcmQ6
NjA1NzY3
235 2.7.0 {mp016} Go ahead
DEBUG: getProvider() returning javax.mail.Provider [TRANSPORT,smtp,com.sun.mail.smtp.SMTPTransport,Su
n Microsystems, Inc]
DEBUG SMTP: useEhlo true, useAuth false
DEBUG SMTP: trying to connect to host "localhost", port 25, isSSL false

--Exception handling in Mailsend.java
javax.mail.MessagingException: Could not connect to SMTP host: localhost,
port: 25;
nested exception is:
java.net.ConnectException: Connection refused: connect at com.sun.mail.smtp.SMTPTransport.openServer(SMTPTransport.java:1213)
at com.sun.mail.smtp.SMTPTransport.protocolConnect(SMTPTransport.java:311)
at javax.mail.Service.connect(Service.java:233)
at javax.mail.Service.connect(Service.java:134)
at javax.mail.Service.connect(Service.java:86)
at com.sun.mail.smtp.SMTPTransport.connect(SMTPTransport.java:144)
at javax.mail.Transport.send0(Transport.java:150)
at javax.mail.Transport.send(Transport.java:80)
at Mailsend.main(Mailsend.java:108)
---------

Even when i add the following properties, i get the same error-message
above:
--------
props.put
("mail.smtps.socketFactory.class","javax.net.ssl.SSLSocketFactory");
props.put("mail.smtps.socketFactory.fallback", "false"); 
props.put("mail.smtps.socketFactory.port", "465");

After smtp-auth the GMX-Mailserver aborts my ssl-request and falls back 
to default properties (non-ssl on port 25). The default properties are
mail.host = localhost
mail.smtp.port = 25 
as you see in the error-message above...

Why???? What am i doing wrong?? Do i have to do anything else, then to put the smtps-properties for building an ssl-conncetion??

Please help me!!

Thank you very much in advance!
Fibo

-- 
Message posted via http://www.javakb.com
0
forum (430)
1/13/2005 2:27:48 PM
comp.lang.java.security 1501 articles. 0 followers. Post Follow

0 Replies
625 Views

Similar Articles

[PageSpeed] 56

Reply:

Similar Artilces:

java.lang.ExceptionInInitializerError: java.lang.ArrayIndexOutOfBoundsException
Hi, I am new to DB2. I am getting this error while loading the DB2Driver. I don't have any idea about where i might have gone wrong. please help me. Below is the stack trace. Stack Trace: java.lang.ExceptionInInitializerError: java.lang.ArrayIndexOutOfBoundsException at COM.ibm.db2.jdbc.app.DB2Driver.SQLAllocEnv(Native Method) at COM.ibm.db2.jdbc.app.DB2Driver.<init>(DB2Driver.java:245) at COM.ibm.db2.jdbc.app.DB2Driver.<clinit>(DB2Driver.java:130) at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Cla...

java 1.4 fail with java.lang.UnsatisfiedLinkError but 1.5, 1.6 ok
My JNI program is working with java 1.5 & 1.6 but fail with java 1.4 on a HP-UX B.11.23 U ia64 computer. Please help even though java 1.4 is old. $ /opt/java1.4/bin/java -d32 -jar jHw.jar Failed to load MycompAPI and MycompAPI_64 libraries. java.lang.UnsatisfiedLinkError: no MycompAPI_64 in java.library.path at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1542) at java.lang.Runtime.loadLibrary0(Runtime.java:795) at java.lang.System.loadLibrary(System.java:834) at com.chrysalisits.crypto.MycompAPI.<clinit>(MycompAPI.java: 47) at com.chrys...

java.lang.StringIndexOutOfBoundsException: String index out of range: 23 at java.lang.String.charAt(String.java:460)
Hi All I am having the torque3.1.jar and postgresql-7.4. I have compiled the new jdbc driver called as postgresql.jar and have placed it in the lib directory from where the ant scripts catch the jars. Whenever i try to access through torque gestList = BaseGestlistPeer.doSelect(new Criteria()); this error arises java.lang.StringIndexOutOfBoundsException: String index out of range: 23 at java.lang.String.charAt(String.java:460) at org.postgresql.jdbc2.ResultSet.toTimestamp(ResultSet.java:1653) at org.postgresql.jdbc2.ResultSet.getTimestamp(ResultSet.java...

java.security.acl.Permission vs java.security.Permission
Hi Interfaces in java.security.acl package accept java.security.acl.Permission interface as their parameters, not java.security.Permission. Why is it so? Why there are two different Permissions which are seem to be related, and can be one. Amir Pashazadeh ...

is there java API for WS-Security?
Hello I am exploring the possibilities of ws-security and its implementation. Could you give me any suggestion whether it is going to be supported by any java api e.g. jax-rpc? or is it going to be a different api that e.g. jax-rpc would refer to? maybe some of had already found some java ws-security free implementation? Thanks for any hints in advance There is a project called WSS4J at apache. But its still underdevelopoment. ...

javamail java.lang.IllegalAccessError:
Hi, Anyone could explain me following error message java.lang.IllegalAccessError: taglibm2.SendTag tried to access method javax/mail/internet/InternetAddress.(Ljava/lang/String;Z)V String temp=null; this.recipients = new StringTokenizer(listto,";"); InternetAddress[] toAddrs = null, ccAddrs = null; // toAddrs = InternetAddress.parse(recipients, false); try { String temp=null; if (recipients != null) { int i=0; toAddrs = new InternetAddress[recipients.countTokens()]; ...

java.lang.Set with elements of type java.lang.Set
Roughly I do something along the lines of: Set set = new HashSet(); Set elem = new HashSet(); set.add(elem); // now we change the elem and add it again to the set elem.add(some object here); set.add(elem); I found out the hard way that 'set' may now contain 'elem' either once or twice, the reason being that 'elem.add()' changes the hashCode of elem such that it is not noticed that it is in 'set' already on the 2nd 'set.add()'. Question: What I would actually want is an IdentityHashSet() set = new IdentityHashSet() but this does not...

A problem with GSS-API (kdc = RH A.S. R3) GSSException: Failure unspecified at GSS-API level (Mechanism level: Checksum failed)
Hi doc!!!!: I am running the Sample with tutorial "Use of JAAS Login Utility and Java GSS-API for Secure Messages without JAAS programming" KDC is a Red Hat Linux AS release 3 JDK 1.5 The Code are SampleClient.java y SampleServer.java without relevant modifications If anyone has any ideas I'm all ears. Don Alex SERVER: Debug is true storeKey true useTicketCache false useKeyTab false doNotPrompt false ticketCache is null KeyTab is null refreshKrb5Config is false principal is mquiroga/pele.uniandes.edu.co@UNIANDES.EDU.CO tryFirstPass is false useFirstPass is false storeP...

to use import java.lang.* or import java.lang.Math or none at all?
Hi guys, i knew that by default all java.lang classes will be imported by the compiler during compilation. but, to make it easier for the computer, should i specify which class i really will be using? does this action will boost the performance during compilation and runtime or not a matter at all? the answer to this post will definitely affect my programming style in the future when i'm considering "to import or not to import"... hmm,,, thanks in advance. JPractitioner wrote: > i knew that by default all java.lang classes will be imported by the > compiler during com...

BUILD FAILED java.lang.OutOfMemoryError
This is a script to kill directories older than so-and-so date. It works for small directory structures; however, it errors out on large directories. Anyone think of a more elegant solution? I'm a novice at this so maybe I'm also not setting up the ant memory usage correctly. (I'm using "set ANT_OPTS=-Xmx500M" in a file called antrc_pre.bat in ant_home). <!-- ********************************************************** ** ArchivePurge ** ** ** ** This buildfile will purge deploy ** ** folders from the archive directory dated ** ** past x months. **...

Secure FTP API for Java Released
MyJavaWorld.com is pleased to announce the release of Secure FTP API for Java, an API that allows you to add secure file transfer capabilities to your Java applications. Some of the features of Secure FTP API for Java are: Complete implementation of the File Transfer Protocol as defined RFC 959 Support for secure file transfer using SSL/TLS as defined in RFC 2228. Both Explicit and Implicit SSL connections are supported. Extendable architecture to support legacy/non-standard FTP servers Event notification to notify the connection and transfer evens to interested objects. ...

Secure FTP API for Java Released
MyJavaWorld.com is pleased to announce the release of Secure FTP API for Java, an API that allows you to add secure file transfer capabilities to your Java applications. Some of the features of Secure FTP API for Java are: Complete implementation of the File Transfer Protocol as defined RFC 959 Support for secure file transfer using SSL/TLS as defined in RFC 2228. Both Explicit and Implicit SSL connections are supported. Extendable architecture to support legacy/non-standard FTP servers Event notification to notify the connection and transfer evens to interested objects. ...

Example of Javamail with SMTP and POP3 on SSL
Hello all, I am new to Javamail. I was working on a project in C++ under MS Windows (I know, boo) and decided to switch to Java. Most things are going well, except the mail part. I need to send and receive E-Mail with POP3 and SMTP running on SSL. I need to use authorization and alternate port numbers. It should be simple, but I don't seem to be able to figure it out. Could someone out there that knows a lot more than me about Javamail (that won't be hard) send or post a simple example of doing this? TIA, Adam On 2005-09-20, Charter <amesser39@hotmail.co...

Newbie question about java security API
Hello, first of all forgive my ignorance about the subject and the likely silliness of my questions. I'd like to use the java security API to provide data integrity features to a database (Oracle). Basically, I want to store in a table a calculated checksum of the content of the record's fields of another table whose data needs to be protected. I guess the procedure should be implemented like: 1) Build a string from the content of the data fields 2) Hash the string 3) Encrypt the hash 4) Store the result (i.e. the checksum) in the table containing the signed records To verify data i...

Web resources about - smtp over ssl fails with JavaMail API - comp.lang.java.security

OpenOffice - Wikipedia, the free encyclopedia
It was formerly known as OpenOffice.org under Sun , then Oracle ownership. OpenOffice's default file format is the OpenDocument Format (ODF), ...

Spring2.5框架上面使用quartz的简单方法 - 软件架构设计
Spring2.5框架下面使用quartz的简单方法 无聊下载了quartz的jar包,配置了一个在spring框架下的定时操作,发送一封邮件玩玩吧 列出来使用的jar包: commons-collections-3.2.jar commons-logging.j

Application development domains and technical expertise - Acceptic
Acceptic has gained an extensive experience in custom PHP-AJAX Web development, .NET apps, mobile software, business, and network C++/Qt programming. ...

Development tools - Android library statistics - AppBrain
Directory of the most popular Android Development tools

CATT Ltd - Offshore Java Development - Java programmers india - Java Softwate Development - Java Application ...
CATT Ltd is having highly skilled Java programmers who are having years of experience in Java Programming. The team�s capability constitutes ...

Java Runtime Environment - Java — Google Cloud Platform
Offers users the ability to build and host web applications on Google's infrastructure.

Issues - gdata-java-client - Google Data Java Client Library - Google Project Hosting
My favorites ▼ - Sign in gdata-java-client Google Data Java Client Library Project Home Downloads Wiki Issues Source New issue Search Search ...

App Engine Features - Google App Engine — Google Developers
Sign in Google App Engine Home Products Conferences Showcase Live Groups Google App Engine Feedback on this document Admin Console System Status ...

Apache TomEE 1.0 brings enterprise-class Java to Tomcat
The Apache Software Foundation has announced the first stable release of Apache TomEE, an edition of Apache Tomcat with Java EE features. The ...

apt-get install java (literally)
Simon Phipps : “Yes, you can now apt-get install sun-java5-jre and have it install without fuss on Debian and Ubuntu.” Great news. We’re one ...

Resources last updated: 2/2/2016 11:12:52 PM