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 1500 articles. 2 followers. Post Follow

0 Replies
569 Views

Similar Articles

[PageSpeed] 3
Reply:
Similar Artilces:

multiple virtual hosts using Apache and ssl
I've been trying (unsucesfuly) to create multiple virtual hosts using secure HTTP. I only seem to be able to create one virtual host using secure HTTP. Does anyone know if this is possible? and if so how? Thanks in Advance, Paul Paul wrote: > I've been trying (unsucesfuly) to create multiple virtual hosts using > secure HTTP. I only seem to be able to create one virtual host using > secure HTTP. Does anyone know if this is possible? and if so how? It isn't possible because SSL has to be negotiated before Apache can decrypt the HTTP headers, but the HTTP ...

Hashmap get failing
I have a hashmap of 13062 items. I am using a String object as the key. map.get(key) retunrs a null when I search for a string with the value "V1272". I traced the population of the HashMap, and see "V1272" going in. So how/why would the get return null? Can anyone give me some debugging hints on this one? Ed (PS - the key and the value are the same object - is there a smarter way to do this?) Edward A Thompson wrote: > I have a hashmap of 13062 items. > > I am using a String object as the key. > map.get(key) retunrs a null when I search for a string w...

netty with ssl
Hi I'm using the netty with ssl, but it doesn't work.This is my error log and= the ssl code. error code: adding as trusted cert: Subject: EMAILADDRESS=3Dxxx, CN=3DLouie, OU=3DSDG, O=3DSDG, L=3DSH, ST=3D= SH, C=3DCN Issuer: EMAILADDRESS=3Dxxx, CN=3DLouie, OU=3DSDG, O=3DSDG, L=3DSH, ST=3D= SH, C=3DCN Algorithm: RSA; Serial number: 0xffc3decf334dd844 Valid from Mon Jul 27 17:05:34 CST 2015 until Thu Jul 24 17:05:34 CST 202= 5 trigger seeding of SecureRandom done seeding SecureRandom NewsInterface server listening on port 443 Using SSLEngineImpl. Using SSLE...

I failed! :'(
I am announcing my defeat: I haven't been able to even match the Deflate te= chnique. :'( I thought a couple times that I was doing better, only to fi= nd out that it only *appeared* that way due to a bug in the program. So, f= or now at least, I admit defeat. It's even worse because I stand much to g= ain from it *and* it is God's will. ...

SMTP+SMTP+IPv4+IPv6
Hello Our server is currently running smtp and smtps on ipv4 only. We have the following lines in our sendmail.mc: DAEMON_OPTIONS(`Family=3Dinet, Port=3Dsmtp')dnl DAEMON_OPTIONS(`Family=3Dinet, Port=3Dsmtps, Name=3DMTA-SSL, M=3Ds')dnl I've tried to use ipv6 by duplicating these lines like this: DAEMON_OPTIONS(`Family=3Dinet, Port=3Dsmtp')dnl DAEMON_OPTIONS(`Family=3Dinet, Port=3Dsmtps, Name=3DMTA-SSL, M=3Ds')dnl DAEMON_OPTIONS(`Family=3Dinet6, Port=3Dsmtp')dnl DAEMON_OPTIONS(`Family=3Dinet6, Port=3Dsmtps, Name=3DMTA-SSL-V6, M=3Ds')dnl But after this the client...

OpenSSL Ruby 1.9? "Certificate verify failed"
Hi Guys! I'm trying to use OpenSSL with Ruby 1.9.1 but each time it tells me "SSLv3 read server certificate B: certificate verify failed (OpenSSL::SSL::SSLError)". Also, I had to copy ssleay32.dll and libeay32.dll else it wouldn't have "worked".. Here's the ruby code: require 'net/https' require 'uri' uri = URI.parse(ARGV[0] || 'https://gmail.com/') http = Net::HTTP.new(uri.host, uri.port) http.use_ssl = true if uri.scheme == "https" # enable SSL/TLS http.start { http.request_get(uri.path) {|r...

smtp
All the sudden I can't send email. My isp has not changed. I can receive email. I can send email with Outlook with same pop and smtp setting as in the Eudora email accounts. What is Eudora doing? surfeagle wrote: > > All the sudden I can't send email. My isp has not changed. I can > receive email. I can send email with Outlook with same pop and smtp > setting as in the Eudora email accounts. > > What is Eudora doing? Which version of Eudora are you using? Did your ISP recently begin requiring SMTP authentication? Are you receiving any error message...

Call for an API standard for SQL statements
It does not seem to exists any standard for how to define SQL statements in a object oriented API. Currently different products have completely different syntax. Until such standard exists, people can always argue that it safer to type SQL statements directly as strings in the application source code. But there are many situations there an application framework need to know how the statements is built up, not just that it is a stream of characters. Is it someone here interested to try to make a draft for such standard? Fredrik Bertilsson http://butler.sourceforge.net Fredrik Be...

Re: Connection Failed
Do you have access? You can check by the following: proc setinit noalias; run; In order to use Proc Import-DBMS=Excel statements, you must license and install SAS/ACCESS Interface to PC Files, in addition to your Base SAS Software. The following code will write a list of the products in your site license to your SAS Log: proc setinit noalias; run; If the product is in the list, then it may not be installed. On 12/12/07, msiddu2000 <msiddu2000@gmail.com> wrote: > > SAS 9.1 import wizard is having problem with excel file imports, it > works ok for .txt files. > I...

DeriveParameters method fails if UDR parameter defined using LIKE
Ref: http://www-1.ibm.com/support/docview.wss?rs=681&context=SSVT2J&dc=DB550&uid=swg1IC50772&loc=en_US&cs=UTF-8&lang=en&rss=ct681db2 Apparently upgrading to at last CSDK 3.00 should have fixed the problems with DeriveParameters but alas I fear not. I'm using CSDK 3.50.TC1 and I'm still having problems: 1. DeriveParameters fails with a "Specified cast is not valid" exception when deriving a parameter from a UDR parameter defined using LIKE. Columns defined as int seem fine but columns defined as varchar fail - I haven't tried othe...

Package `smtp'
I'm wondering, is it possible? Anyone tried it? -- Zbigniew ZB wrote: > I'm wondering, is it possible? Anyone tried it? Yes and yes. Did you check either wiki.tcl.tk or ActiveState's recipes for how to do it? -- +------------------------------------------------------------------------+ | Gerald W. Lester | |"The man who fights for his ideals is the man who is alive." - Cervantes| +------------------------------------------------------------------------+ ...

Measuring Smtp traffic
Hi, Is there any easy way to measure smtp traffic from Cisco router? We are trying to find out much bandwidth taken by smtp... Thank you In article <f86fbc.0409160613.72d1fdd7@posting.google.com>, baboman@mail.com says... > Hi, > > Is there any easy way to measure smtp traffic from Cisco router? > > We are trying to find out much bandwidth taken by smtp... > > Netflow can do that. -- -Ivan. *** Use Rot13 to see my eMail address *** ...

RE: [ace-users] Re: Win32 TAO server build fails
Hi, I have encountered this problem before. If you don't want to be 64bit compatible you should change the compilation switch "Detect 64-bit Portability Issues" to NO. You can find this switch on the General property page in the project. Hope this solves your problem, ~ Ishay Green -----Original Message----- From: owner-ace-users@cse.wustl.edu [mailto:owner-ace-users@cse.wustl.edu] On Behalf Of Steve Huston Sent: Monday, November 07, 2005 11:39 PM To: 'Douglas C. Schmidt'; ptmcg@austin.rr.com; ace-users@cs.wustl.edu Subject: RE: [ace-users] Re: Win32 T...

Re: FTP failing to connect. #5
Ron, Had thought about that one. The confusing thing is that it used to work and had done so for several weeks. They insist that no changes have been made at their end and I know that we have not made any. regards, Robert W.Mills Systems Development Manager Windsong Services (01689) 870622 x3005 Ron Horner <mailto:Ronh@ladyremingtonjewelry.com> wrote on 15 December 2003 16:19: > It could be an issue of port that FTP comes through. I believe the > port > number is 21. If the firewall is sensitive to the FTP port, you may > not get > in. At the ...

Re: failed to lookup type 0
Thanks both for your response. Here is a screen shot with the table definition and reproducible example: mm=# \d signon Table "public.signon" Column | Type | Modifiers ---------+-----------------------+----------- name | character varying(25) | not null user_id | bigint | not null passwd | character varying(30) | not null Indexes: signon_pkey primary key btree (user_id), signon_name_key unique btree (name) mm=# insert into signon values ('dump',3434343,'wdp'); INSERT 256495 1 mm=# delete fro...

SMTP Test Util
Hi, I'm in the process of building a load-balanced smtp server and before commissioning I'd like to do extensive testing. In particular I want to ensure that the load is effectively being spread between the two servers. I wonder if anyone has come across a utility that can fire several hundred smtp messages at a given IP address. I don't need attachments, and the text could even be the same for each message sent, as I primarily want to check the quese on the mail servers as the messages pass through to confirm both servers are responding. Regards, Chris > I wonder if any...

SMTP
Good day all I am new to the Python list My question is here not Python as much as it is in servers I have a code to send an email through my SMTP server - comcast Boston fromaddrs = "******" toaddrs = "sgeorge@coe.neu.edu" msg = "Hello World" server = smtplib.SMTP ('76.96.30.117', '25') #COMCAST BOSTON server.set_debuglevel(1) try: server.sendmail(fromaddrs, toaddrs, msg) finally: server.quit() Which basically sends a hello world message Debugging gives me an indication of acceptance as seen below (and I as googled it) I tried the same ...

SMTP Ports
I am currently using Eudora 6.2.3 I have my client working with 6 different personalities. Now everything has been fine... but lately my different email providers have changed their ports as in 25 and 587 etc. Right now if I want to send mail using my different email provicders I must go into port setting in Eudora and change to proper port for that provider. Is there a way that Eudora can handle multiple ports or atleast assign designated ports to each personality...?? Thanks in advance. Gordon Please reply within newsgroup ONLY. I do not read emails sent to...

installing 6.1 - creat/symlinks failed
I am installing 6.1 from CD on a virtual machine using Microsoft Virtual PC 2004. Freebsd is supposed to work with it. While installing packages during the install process, I get the error messages as it goes through perl, expat,... "creat/symlinks failed - no inodes free" What can I do about this? (you might have guessed, I am sort of a newbie) Notgiven <notreallyme@invalid.invalid> wrote: >I am installing 6.1 from CD on a virtual machine using Microsoft Virtual PC > 2004. Freebsd is supposed to work with it. > > While installing packa...

Win API and others for Finding network drives
Hi, I have to write a m-script in which I have to get the UNC path of a network drive and assign that path as the path for something else. So I was looking for info on how to get the UNC path of a n/w drive and found the "EnumNetworkDrives" which returns a windows script host object "WshNetwork" - which fetches the parameters I need. Now how do I use this in an m-script? Thanks in advance Cheers /JP PS: Links for info on the windows script host and the "EnumNetworkDrives" : http://msdn.microsoft.com/library/default.asp?url=/library/en-us/script56/html/3b...

VPN with Netgear FVS338 fails
I want to establish a VPN connection from a client (Windows XP SP2, Netgear ProSafe VPN Client Software) over the internet to a Netgear FVS338 ProSafe VPN Firewall. After two days of trying, I'm starting to get mad. The process fails after initiating IKE Phase 2. This is the log from the Netgear ProSafe VPN Client (leading date/time information was deleted for better reading): Attempting to resolve Hostname (xxx.dyndns.org) Initiating IKE Phase 1 (Hostname=xxx.dyndns.org) (IP ADDR=xxx.xxx.xxx.xxx) SENDING>>>> ISAKMP OAK AG (SA, KE, NON, ID, VID 6x) RECEIVED<<...

Email SMTP, trying to send to internal smtp server.
I am working with a outside programming to configure our AS400 to send messages to employees at our company. Right now using snddst command I am able to send messages outside our network. I am not sure what the programmer turned on and has running, but I can't get anything to be sent to internal accounts. Currently the name of AS400 is as400.ourdomain.com and we have an exchange.ourdomain.com I would like to use to send the messages to. But nothing goes through these smtp servers. Do I need to turn off smtp, I not sure if pop is running? or MSF? Any pointers. Thanks, Kevin Well ...

Repair permissions failed. Trouble?
I've recently tried to repair permissions on my hard drive and at some point of the process the application aborted and told me to quit and restart. The progress bar was still present and once when I tried to quit the application told me that if I quit while repair permissions is still in progress it might render the hard disk unusable. However since the there was nothing happening for an hour I had to quit. I went and started to backup the disk but at some point while copying the User library Toast aborted due to "error -30" and later showed an "error -50&qu...

Why does pthread_create fail?
I am trying to create a thread and getting an error value that doesn't match the documentation. Using the following code: static pthread_t readThreadid = 0; int pthread_createStatus; int prevErrno; if (readThreadid == 0) { prevErrno = errno; pthread_createStatus = pthread_create(&readThreadid, NULL, jsReadThread, NULL); if (pthread_createStatus != 0) { printf("pthread_create failed, " "status = %d, errno = %d, prevErrno = %d\n " "(options are ENOMEM=%d,...

Re: %fmtpath macro failes. #6
Randy, As I'm sure you are aware, it is not necessary to replace data steps or procs with SAS Component Language unless you have compelling reasons to. One reason I/O with SAS Component Language does not compare favorably with data step I/O is that it uses an additional data vector to manage the flow of data between a SAS data table and SAS Component Language variables. Joe -----Original Message----- From: SAS(r) Discussion [mailto:SAS-L@LISTSERV.UGA.EDU] On Behalf Of Randy Herbison Sent: Thursday, May 12, 2005 2:16 PM To: SAS-L@LISTSERV.UGA.EDU Subject: Re: %fmtpath macro failes. I wo...