Question:
I get the following error when trying to send email using outlook.office365.com
ChilkatLog: SmtpNoop: DllDate: Aug 15 2013 ChilkatVersion: 9.4.1.42 UnlockPrefix: Username: Architecture: Little Endian; 32-bit Language: ActiveX VerboseLogging: 1 SmtpConnect: SmtpHost: outlook.office365.com SmtpPort: 587 SmtpUsername: *
SmtpSsl: 1 StartTLS: 1 Need new SMTP connection checkForExistingConnection: Elapsed time: 0 millisec SMTP_Connect: Connecting to SMTP server outlook.office365.com:587 smtp_host: outlook.office365.com smtp_port: 587 smtp_user: * ConnectTimeoutMs_1: 30000 calling ConnectSocket2 IPV6 enabled connect with NO heartbeat. connectingTo: outlook.office365.com ... connect successful (1) clientHelloMajorMinorVersion: 3.1 buildClientHello: majorVersion: 3 minorVersion: 1 numRandomBytes: 32 sessionIdSize: 0 numCipherSuites: 10 numCompressionMethods: 1 --buildClientHello readIncomingTls_serverHello: readTlsRecord: v50.48, ct=50, sz=8258 Timeout waiting to read socket or accept connection timeoutMs: 30000 Failed to read TLS record (2) tlsRec_msg: 104 msgLen: 8258 --readTlsRecord --readIncomingTls_serverHello Expected ServerHello but did not receive it. Client handshake failed. (3) Failed to connect to SMTP server. --SMTP_Connect smtpConnect: Socket timeout. checkOrMakeSmtpConnection: Elapsed time: 30186 millisec --SmtpConnect Failed to connect to SMTP server --SmtpNoop --ChilkatLog
Port 587 is the explicit SSL/TLS port for the SMTP protocol. The implicit SSL/TLS port is 465. The difference between implicit SSL and explicit SSL is that for implicit, the SSL handshake begins immediately after establishing the TCP socket connection. For explicit SSL, the SSL handshake (i.e. the conversion of the TCP socket connection to an SSL/TLS secure channel) happens when the SMTP client explicitly sends a command to the server to initiate the SSL handshake. In the SMTP protocol, this happens with the "STARTTLS" SMTP command.
Therefore, to use explicit SSL with port 587, set the mailman.StartTLS property = 1 (which is for explicit SSL/TLS), but leave the mailman.SmtpSsl property = 0 (which is for implicit SSL/TLS). It never makes sense to set both the SmtpSsl and StartTLS properties = 1.