The company's cloud platform has turned off the fsockopen, if you want to use the SMTP extranet mailbox to send mail, you can only try to use curl to do
Google first, found a lot of questions related to the question but there is no relevant answer, in the phpclasses also found no related classes and then he looked at the stmp of the relevant protocol side began to try Curl
SMTP protocol
This can be found on the Internet more relevant examples, you can experiment with the use of Telnet to connect to the mail server
$ Telnet Mailbox SMTP Service address 25Trying mailbox Service IP Address ... Connected to mailbox SMTP Service address. Escape character is ' ^] '. The address of the Exchange Mailbox server Microsoft ESMTP Mail Service Ready at Sat, 2 June 2012 15:02:12 +0800ehlo 127.0.0.1250-exchange Mailbox server address Hello [mailbox Service IP Address]250- Size250-pipelining250-dsn250-enhancedstatuscodes250-x-anonymoustls250-auth NTLM Login250-x-exps GSSAPI ntlm250-8bitmime250-binarymime250-chunking250-xexch50250 xrdstauth LOGIN334 vxnlcm5hbwu6 user name (Base64_encode) 334 Ugfzc3dvcmq6 Password (base64_encode) 235 2.7.0 authentication Successfulmail from: Outbox address 2.1.0 Sender OKRCPT to: Inbox address 250 2.1.5 Recipient OKDATA354 Start mail input; End With
.
What to send (there are many related specifications here). 2.6.0 <0b476f30-3b96-4e3d-84d2-395a96d34000@exchange Mailbox server address > Queued mail for deliveryQUIT221 2.0.0 Service closing transmission channelconnection closed by foreign host.
PHP Test Code:
1
"Mailbox SMTP Server Address", 5 "port" + "Mailbox SMTP Server Port",//General 6 "username" + "user name", 7 "password" + "password", 8 "from" + "e-mail", 9 "to" and "=" "Receiving address", "Subject" and "" Test the title "," Body "and" and "Test a $CRLF = "\ r \ n"; $test = ""; $curl = Curl_init (); curl_setopt ($curl, Curlopt_url, $smtp [' URL ']); 19 curl_setopt ($curl, Curlopt_port, $smtp [' PORT ']), curl_setopt ($curl, curlopt_timeout,10); function Inlinecode ($ str) {$str = Trim ($STR), and return $str? ' =? UTF-8? B? '. Base64_encode ($STR). '? = ': ';}26 function Buildheader ($headers) {$ret = "; foreach ($headers as $k = = $v) {$ret. = $k . ': '. $v. " \ n ";}32 return $ret;}34//$header = Array (PNS ' return-path ' = ' < '. $smtp [' from ']. ' > ', ' Date ' =>date (' R '), ' from ' + ' < '. $smtp [' from ']. ' > ', mime-version ' + ' 1.0 ', ' Subject ' =>inlinecode ($smtp [' Subject ']), ' to ' and ' = ' $smtp[' to '],43 ' content-type ' = ' text/html; Charset=utf-8; Format=flowed ', content-transfer-encoding ' base64 '); $data = Buildheader ($header). $CRLF. Chunk_split ( Base64_encode ($smtp [' body ']); $content = "EHLO". $smtp ["url"]. $CRLF; First of all, hello $content. = "AUTH LOGIN". $CRLF. Base64_encode ($smtp ["username"]). $CRLF. Base64_encode ($smtp ["Password" ]). $CRLF; Verify login $content. = "MAIL from:". $smtp ["from"]. $CRLF; The sending address is $content. = "RCPT to:". $smtp ["to"]. $CRLF; The pickup address is $content. = "DATA". $CRLF. $data. $CRLF. ".". $CRLF; Send content $content. = "QUIT". $CRLF; Exit curl_setopt ($curl, Curlopt_returntransfer, true); Curl receives the returned data curl_setopt ($curl, Curlopt_customrequest, $content); $test = Curl_exec ($curl); Var_dump ($test); 60 echo "
\ r \ n "; var_dump ($content); 62 63//End Curl_close ($curl);
The above is just a test of PHP
Package test + modification took nearly 6 hours to make the product code compatible with Fsockopen and curl
Have time to write an SMTP class that fsockopen and curl simply sends mail