-
Notifications
You must be signed in to change notification settings - Fork 30
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Example code not working #17
Comments
Having the same problem, and I've narrowed it down a bit. If I turn off TLS on the sending side, the server works as expected. Not sure where to go from here to debug further, though... |
Hi, I'm sorry for this. I have to debug the code line-by-line. Maybe rewriting the example from scratch with a better approach. Creating the certificate in the example code is not a good idea. This script should not focus on creating an SSL certificate, rather on handling the SMTP server. |
Nothing to be sorry for! Bugs are part of the process (assuming it even is a bug). If it helps, the stream_socket_enable_crypto call at StreamSocket.php:170 does not return an error or warning, but once it has been called the stream_socket_recvfrom call at line 135 starts returning FALSE. Of course this should be returning a string, but even worse is that the dataRecv method of the Client class does not know what to do with a FALSE response, so it keeps looping and looping. |
More info, in case it may help: I removed the self-signed certificate and purchased a real one. The problem still exists, so I don't believe the self-signing is the issue (but of course I may have screwed up the certificate somehow). If there's anything else I can do to help track this down, please let me know. |
Technically there is no different between a self-signed certificate and a purchased real one. |
Indeed; I interpreted the second line of your original response to indicate you thought the certificate creation in the example code may be a problem, so I tried to verify that it is not. If I misinterpreted your comment, I apologize. |
Ah, I see. This was a miscommunication. I meant that the example script and this project should not focus on creating certificates at all. Only take the path to an existing certificate. I'll remove the example in the next version and create an extra examples directory with different example files. |
Gotcha. Note, though, that this issue definitely seems to be irrespective of the example code. Any attempt I've made to use the SMTP server with TLS is failing in the manner described above. |
Testing with OpenSSL command line doesn't give me any hints, but perhaps you will understand the attached log better. |
Progress, maybe. At least some information, if not a fix. Replace stream_socket_recvfrom and stream_socket_sendto with fread and fwrite, respectively, and it works. |
@jonevance @zookatron Are you on master, or a specific version? |
0.3 |
That's really old. We are already at 0.7. |
Sorry about that. Your README.md instructs to install via: I've upgraded to 0.7 and the problem persists, and is still "fixable" by swapping the recv and send with fread and fwrite. |
Hi all, @TheFox I've tried several different versions of the library and they all appear to have the same bug for me, including version 0.7. @jonevance Your "replace stream_socket_recvfrom and stream_socket_sendto with fread and fwrite" fix is working perfectly for me, thanks, that is a huge help! @TheFox Any chance we could get this fix merged into master? Would it help to create a PR? |
Prefer to have the stream functions work, of course, but I've tried everything; the problem really seems to be in the underlying system. |
@TheFox Same happens here with the current master.
|
I ran into the same issue and can confirm that TheFox/network#1 from @aaronschmied fixes it |
How to reproduce:
php version
packages
server.php
email.php
run server & send email:
server.php output:
email.php output:
The server does not appear to be receiving the "EHLO tim-workstation" command that is being sent by PHPMailer and so it just continually spins with no received data. Are you able to reproduce this? Do you know why this might be happening? Your library appears to be using a custom networking library and I'm not familiar enough with the low-level networking functions to debug effectively. If you could point me in the right direction I could probably write up a fix.
The text was updated successfully, but these errors were encountered: