Re: Re: Setting PHP to use SMTP
| From: | Chris | Date: | Mon, 16 Oct 2006 07:40:08 +0000 |
| Subject: | Re: Re: Setting PHP to use SMTP | ||
| References: | 1 2 3 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-243180@lists.php.net to get a copy of this message | ||
Dave M G wrote:
David, Thank you for your response.It's not simple. Basically you need to: - open a socket - send commands through - check that worked - check *each* response that comes back - make sure it's a valid response (from the smtp server) - send more data rinse, repeat. There are tons of checks you need to do at each step and getting the format of the email, headers and commands right is painful (and even then it can break depending on the type of server you're going to send through - windows servers are slightly different to *nix servers even though they are both supposed to be rfc compliant). If you really want to do it yourself, the easiest way would be to look at how phpmailer or something like it handles the process - turn debug on (I'm sure the docs mention how to do this) and watch the commands fly (and there are a lot of commands). My code to do all of that is over 400 lines (but does include debug statements) - and that's just to send a message through the smtp server (connect, send the necessary commands, check return codes and so on). -- Postgresql & php tutorials http://www.designmagick.com/If you are on *nix and want to send mail via SMTP, you need something like http://phpmailer.sourceforge.net/I have looked at phpmailer, but it's way over featured for what I want to accomplish. The tutorial they link to on their site, 11 pages long and full of settings I don't need, really turns me off. Is there no way to simply force my PHP emails through SMTP? I'm happy about everything else with my email set up, so surely there's a way to handle this one thing.