Clicatell SMTP API に電子メールを送信する php を送信しようとしています。アイデアは単純です - 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
ただし、すべてを1行で取得しています。そして、助けていただければ幸いです。