MailerApi

请求URL
http://www.xsico.cn/mailer/api.php?id=1

请求参数
HTTP/POST

1.系统级参数:

参数名称类型示例值必须描述
subjectStringHello邮件标题
bodyStringNice to meet you.邮件正文
toStringadmin@ikay.me收件邮箱

2.应用级参数

参数名称类型示例值必须描述
fromnameStringMailerApi发件人名称
altbodyString一封公司内部邮件正文提示
smtpStringsmtp.qq.com,a@qq.com,123,a@qq.comSMTP鉴权

HTML

<form action=”http://www.xsico.cn/mailer/api.php?id=1″ method=”post”>
<div class=”main” id=”sav”>
<p>MailerApi:<a href=”http://www.xsico.cn/mailerapi/” target=”_blank”>http://www.xsico.cn/mailerapi/</a></p>
<ul id=”g_list”>
<li></li>
<li>发件人名称:<input type=”text” class=”inputstyle” id=”fromname” name=”fromname” value=”Mailer” /></li>
<li>邮件标题:<input type=”text” class=”inputstyle” id=”subject” name=”subject” /></li>
<li>邮件正文:<textarea class=”inputstyle” id=”body” name=”body” ></textarea></li>
<li>收件邮箱:地址之间“;”间隔<input type=”text” class=”inputstyle” id=”to” name=”to” />
</li>
</ul>
<input type=”submit” class=”btn” value=”Send” />
</div>
</form>

PHP

<?php
function send_mail() {
$url = ‘http://www.xsico.cn/mailer/api.php?id=1’;

$param = array(
‘fromname’ => ‘MailerApi’,
‘to’ => ‘myikay@yeah.net’,
‘subject’ => ‘MailerApi’,
‘body’ => ‘Nice to meet you!’,
);

$data = http_build_query($param);

$options = array(
‘http’ => array(
‘method’  => ‘POST’,
‘header’ => ‘Content-Type: application/x-www-form-urlencoded’,
‘content’ => $data
)
);

$context  = stream_context_create($options);
$result = file_get_contents($url, false, $context);

return $result;
}
echo send_mail();
?>

CC共享许可协议:BY-NC-SA 4.0 - 友情链接 - Theme by Qzhai