Last active
September 8, 2015 21:16
-
-
Save ety001/313e8a0364b8e1ab6758 to your computer and use it in GitHub Desktop.
send_post_data_by_filegetcontents.php
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function send_mail() { | |
$url = 'http://sendcloud.sohu.com/webapi/mail.send.json'; | |
//不同于登录SendCloud站点的帐号,您需要登录后台创建发信子帐号,使用子帐号和密码才可以进行邮件的发送。 | |
$param = array('api_user' => 'ety001_test_NfyMuy', | |
'api_key' => 'uAurAI3tVzbId2Kq', | |
'from' => '[email protected]', | |
'fromname' => 'SendCloud测试邮件', | |
'to' => '[email protected]', | |
'subject' => '来自SendCloud的第一封邮件!', | |
'html' => '你太棒了!你已成功的从SendCloud发送了一封测试邮件,接下来快登录前台去完善账户信息吧!'); | |
$query = http_build_query($param); | |
$options = array( | |
'http' => | |
array( | |
'header' => "Content-Type: application/x-www-form-urlencoded\r\n". | |
"Content-Length: ".strlen($query)."\r\n". | |
"User-Agent:MyAgent/1.0\r\n", | |
'method' => 'POST', | |
'content' => $query | |
) | |
); | |
$context = stream_context_create($options); | |
$result = file_get_contents($url, false, $context); | |
return $result; | |
} | |
echo send_mail(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment