note 113244 added to transports.inet
| From: | christian at lantian dot eu | Date: | Tue, 17 Sep 2013 12:46:20 +0000 |
| Subject: | note 113244 added to transports.inet | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-196278@lists.php.net to get a copy of this message | ||
@pablo dot livardo : I think that the problem you found is caused by the difference between the
client/server encryption methods used.
The 465 port is used for SMTPS, and the server starts the encryption immediately it receives your
connection. So, your code will work.
The 587 port is used for Submission (MSA or Mail Submission Agent) which works like the port 25. The
server accepts your connection and doesn't activate the encryption. If you want an encrypted
connection on the port 587, you must connect on it without encryption, you must start to dialog with
the server (with EHLO) and after that you must ask the server to start the encrypted connection
using the STARTTLS command. The server starts the encryption and now you can start as well the
encryption on your client.
So, in few words, you can not use :
<?php $fp = fsockopen("tls://mail.example.com", 587, $errno, $errstr); ?>
but you can use:
<?php $fp = stream_socket_client("mail.example.com:587", $errno, $errstr); ?>
and after you send the STARTTLS command, you can enable the crypto:
<?php stream_socket_enable_crypto($fp, true, STREAM_CRYPTO_METHOD_SSLv23_CLIENT); ?>
P.S. My previous note on this page was totally wrong, so I ask the php.net admin to remove it.
:)
----
Server IP: 69.147.83.199
Probable Submitter: 5.12.168.230
----
Manual Page -- http://php.net/manual/en/transports.inet.php
Edit -- https://master.php.net/note/edit/113244
Del: integrated -- https://master.php.net/note/delete/113244/integrated
Del: useless -- https://master.php.net/note/delete/113244/useless
Del: bad code -- https://master.php.net/note/delete/113244/bad+code
Del: spam -- https://master.php.net/note/delete/113244/spam
Del: non-english -- https://master.php.net/note/delete/113244/non-english
Del: in docs -- https://master.php.net/note/delete/113244/in+docs
Del: other reasons-- https://master.php.net/note/delete/113244
Reject -- https://master.php.net/note/reject/113244
Search -- https://master.php.net/manage/user-notes.php