31 Oct 2011 14:52
SMTP with TSL
Eric & Sherrell <svsarana <at> yahoo.com>
2011-10-31 13:52:06 GMT
2011-10-31 13:52:06 GMT
Hi everyone, I've been trying to use cURL with a tsl connection to an smtp server. I've found the following problems: 1. PHP curl with telnet and tsl can't connect. Anyone know how to do this? 2. There seems to be no SMTP support with the php libraries. However I saw this example for libcurl: http://curl.haxx.se/libcurl/c/smtp-tls.html. Does this mean it might be coming? Hacked Solution: Using curl with an https connection I was able to find a hack that allowed me to send out simple SMTP messages by putting the entire smtp command strings and message into the customrequest field setting when connecting to the server. Example snipit: curl_setopt($this->curl_handle, CURLOPT_URL, "https://$this->host:$this->port";); curl_setopt($this->curl_handle, CURLOPT_SSL_VERIFYPEER, true); curl_setopt($this->curl_handle, CURLOPT_SSL_VERIFYHOST, true); curl_setopt($this->curl_handle, CURLOPT_CAINFO, "cacert.pem"); // local root CA copy curl_setopt($this->curl_handle, CURLOPT_CAPATH, "./"); curl_setopt($this->curl_handle, CURLOPT_RETURNTRANSFER, TRUE); curl_setopt($this->curl_handle, CURLOPT_HTTPHEADER, ""); $out = "AUTH LOGIN\r\n"; $out .= base64_encode($this->user) . "\r\n"; $out .= base64_encode($this->password) . "\r\n"; $out .= "MAIL FROM: <$from>\r\n"; $out .= "RCPT TO: <$to>\r\n"; $out .= "DATA\r\n"; $out .= "To: $to\r\n"; $out .="From: $from\r\n"; $out .="Subject: $subject\r\n\r\n";(Continue reading)
RSS Feed