我正在尝试发送一个 php,它将向 Clicatell SMTP api 发送电子邮件。这个想法很简单 - 使用 PHP SOAP 客户端调用 SQL 服务器,获取回复并将此回复插入到发送到 Clicatell 服务器的电子邮件正文中。
<?php
$to = 'sms@messaging.clickatell.com';
$today = strtoupper(date('dMy'));
$subject = 'Test sms sent on ' . $today;
// API request and response goes here
//this is how the response from the api looks like
$response ='To:4412345677693\r\nTo:4412345665693\r\nTo:4412375677693\r\nTo:4463879456776\r\n';
$message = 'api_id: 12345678\r\nuser:user1234\r\npassword:PxAxSxSxWxOxRxD\r\n' . $response . 'Reply: youremail@yourdomain.com\r\ntext:Test Message Using Clickatell api\r\n';
$headers = 'MIME-Version: 1.0' . '\r\n';
$headers .= 'Content-type:text/html;charset=UTF-8' . '\r\n';
$headers = 'From: no-reply@example.com' . '\r\n' .
mail($to,$subject,$message,$headers);
?>
这应该有望以纯文本形式生成电子邮件,如下所示:
To: sms@messaging.clickatell.com
api_id: 12345678
User: user1234
Password: PxAxSxSxWxOxRxD
To:4412345677693
To:4412345665693
To:4412375677693
To:4463879456776
Reply: youremail@yourdomain.com
text: Test Message Using Clickatell api
但是,我将所有内容都集中在一条线上。帮助将不胜感激。