March 22nd, 2013, 08:30 AM
Sending email from PHP....telnet style
I have my own dedicated SMTP server (running postfix).
At the moment I connect to it using PHPMailer to send bulk marketing emails, but I'm not getting the feedback I require from PHPMailer
I've considered switching to swiftmailer as this seems more comprehensive and can capture failed emails...but it does this by address only.
When I telnet to my server I can issue HELO, RCPT TO, MAIL FROM and DATA commands.
I also get feedback - I get the message queue id from postfix. I can use this ID to later interrogate the mail logs for deferals, bounces, deliveries etc
What I can't seem to do is replicate the process from a PHP script.
I have tried to use proc_open("telnet <ip> 25",$desc,$pipes) and then reading from and writing to the pipes. I've also tried to proc_open /bin/bash and then issue the telnet cmd on the input stream.... none of this seems to work. I can open the streams but cannot set them to be non-blocking so attempting to read from them (which is important) hangs forever.
Am I even going about this in the right way?
I considered using fsockopen...but wasn't sure how to do the two way communication (ie continuing to issue commands and read the feedback)
March 22nd, 2013, 08:47 AM
I ♥ ManiacDan & requinix
This is a sig, and not necessarily
a comment on the OP:
don't be a help vampire
March 22nd, 2013, 10:23 AM
Ah, so multiple fputs after opening the socket...didn't know I could do that!