【发布时间】:2015-11-18 07:14:37
【问题描述】:
我正在尝试通过我的 gmail 帐户使用 phpmailer 发送 SMS。
这是我的代码:
require_once('../class.phpmailer.php');
$mail = new PHPMailer();
$mail->IsSMTP();
$mail->SMTPAuth = true;
$mail->SMTPSecure = "tls";
$mail->Username = "myusername@gmail.com";
$mail->Password = "mypassword";
$mail->Host = "smtp.gmail.com";
$mail->Port = 587;
$mail->SetFrom('myusername@gmail.com', 'DS');
$mail->Subject = 'hello';
$mail->Body = 'this is a testing mail..';
$mail->AddAddress('xxxxxxxxxx@ideacellular.net','testname');
if (!$mail->send()) {
echo "Mailer Error: " . $mail->ErrorInfo;
} else {
echo "Message sent!";
}
xxxxxxxxxx@ideacellular.net 表示mobilenumber@carrierdomain。
当我执行这个脚本时。输出是:消息已发送!
但是没有收到短信。
如果我的代码有任何错误(或)使用phpmailer 发送SMS 的方式无效,请告诉我。
使用此代码(将 AddAddress 字段更改为电子邮件而不是手机号码)我可以发送邮件。
但是无法发送短信。
是否可以使用 phpmailer 发送短信?
请帮我解决这个问题.. 非常感谢任何帮助。
【问题讨论】:
-
phpmailer 仅用于电子邮件...通常第三方 SMS 插件需要付费
-
邮件是否转发到手机?
-
不,电子邮件发送到电子邮件ID(如果我提供电子邮件ID),但我想向手机发送消息(如果我提供手机号码)
标签: php gmail sms phpmailer sms-gateway