Im building an automated newsletter, im kinda stuck with this problem. I need to know if the email was sent or not. Here is my code
@$send = mail($emailReci
Only for sake of completeness it should be mentioned that there is a way to send an email via PHP and to know whether it is really accepted by receiving MTA (which, again, doesn't mean it is delivered to user or discarded silently after SMTP handshake) or not.
One could theoretically write an SMTP client purely in PHP, for example using built-in Stream functions like stream_socket_client in order to talk to receiving MTA via direct raw tcp connections formed in SMTP protocol requests and responses.
General logic of issuing SMTP commands would be like:
Of course, this is blatantly incomplete (experienced devs would notice that I wasn't neither listening nor parsing to SMTP responses I'd get). In order for this approach to be used serious re-inventing the wheel in PHP language has to be performed.
Well, you would have at least 3 types of information:
250 2.0.0 Ok after submitting message textAgain, this is only for educational purposes, don't do this at home unless you're prepared to marry the project of developing standard-compliant SMTP client.