简体   繁体   中英

iOS SSL handshake failed

I am trying to use SMTP to send email in my app without using iOS default mail system. However, I receive an SSL handshake failed info. Does that mean the SMTP server I am trying to use forbid my request? Any advice will be appreciated.

2014-07-03 18:04:20.266 MGM[267:4503] C: Attempting to connect to server at: smtp.apps1010.com:25
2014-07-03 18:04:20.360 MGM[267:60b] *** stopping watchdog ***
2014-07-03 18:04:20.361 MGM[267:60b] S: 220 pan.communilink.net ESMTP
2014-07-03 18:04:20.361 MGM[267:60b] C: EHLO localhost

2014-07-03 18:04:20.362 MGM[267:60b] *** starting short watchdog ***
2014-07-03 18:04:20.370 MGM[267:60b] *** stopping watchdog ***
2014-07-03 18:04:20.370 MGM[267:60b] S: 250-pan.communilink.net
2014-07-03 18:04:20.377 MGM[267:60b] *** stopping watchdog ***
2014-07-03 18:04:20.377 MGM[267:60b] S: 250-STARTTLS
2014-07-03 18:04:20.378 MGM[267:60b] C: STARTTLS

2014-07-03 18:04:20.378 MGM[267:60b] *** starting short watchdog ***
2014-07-03 18:04:20.379 MGM[267:60b] *** stopping watchdog ***
2014-07-03 18:04:20.379 MGM[267:60b] S: 250-PIPELINING
2014-07-03 18:04:20.380 MGM[267:60b] *** stopping watchdog ***
2014-07-03 18:04:20.381 MGM[267:60b] S: 250-8BITMIME
2014-07-03 18:04:20.381 MGM[267:60b] *** stopping watchdog ***
2014-07-03 18:04:20.381 MGM[267:60b] S: 250-SIZE 68000000
2014-07-03 18:04:20.382 MGM[267:60b] *** stopping watchdog ***
2014-07-03 18:04:20.382 MGM[267:60b] S: 250 AUTH LOGIN PLAIN CRAM-MD5
2014-07-03 18:04:20.386 MGM[267:60b] *** stopping watchdog ***
2014-07-03 18:04:20.386 MGM[267:60b] S: 220 Proceed.
2014-07-03 18:04:20.387 MGM[267:60b] Beginning TLSv1...
2014-07-03 18:04:20.388 MGM[267:60b] C: EHLO localhost

2014-07-03 18:04:21.026 MGM[267:60b] CFNetwork SSLHandshake failed (-9807)

Before you send STARTTLS you have to make sure, that you've read the full response from the server to the latest command - in this case this would be EHLO which ends with 250 AUTH.. . After you've send your STARTTLS command you need to wait for the response from the server ( 220 Proceed ) and only after you got the successful response you should start with the TLS handshake. And only after the handshake is done you should continue with sending commands inside the encrypted connection.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM