使用phpmailer向手机发送短信

使用phpmailer向手机发送短信,php,gmail,sms,phpmailer,sms-gateway,Php,Gmail,Sms,Phpmailer,Sms Gateway,我正试图用我的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-

我正试图用我的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字段改为email而不是手机号码),我可以发送邮件

但是短信不能发送

可以使用phpmailer发送短信吗?

请帮我解决这个问题。。
非常感谢您的帮助。

似乎是“ideacellular.net”的问题。 大多数电话公司都有一个电子邮件网关,允许您通过电子邮件向其客户发送短信。您需要确定每个服务提供商的电子邮件地址,并设置一些代码,将其电话号码和服务提供商组合转换为相应的电子邮件地址

检查此链接:

以下代码适用于verizon

需要'class.phpmailer.php'

$mail = new PHPMailer();

// Configure SMTP
$mail->IsSMTP();                
$mail->SMTPDebug  = 2;          // verbose information
$mail->SMTPAuth = true;         
$mail->SMTPSecure = "tls";      
$mail->Host = "smtp.gmail.com";
$mail->Port = 587;
$mail->Encoding = '7bit';       

// Auth
$mail->Username   = "email.address@gmail.com"; 
$mail->Password   = "password"; 

// Check
$mail->Subject = "Testing";     
$mail->Body = "Testing";        


$mail->AddAddress( "##########@vtext.com" ); 
var_dump( $mail->send() );  
更新

要通过电子邮件发送文本消息,您需要知道SMS网关的地址。下面是一些美国主要手机提供商的SMS网关列表。如果某个运营商不在列表中,请在网站上搜索该运营商,您可能会找到他们的短信网关地址

AllTel: number@message.alltel.com
AT&T: number@txt.att.net
Boost Mobile: number@myboostmobile.com
Cricket: number@sms.mycricket.com
Nextel: number@messaging.nextel.com
Qwest: number@qwestmp.com
Sprint: number@messaging.sprintpcs.com
T-Mobile: number@tmomail.net
Tracfone: number@mmst5.tracfone.com
U.S. Cellular: number@email.uscc.net
Verizon: number@vtext.com
Virgin Mobile: number@vmobl.com
此外,您还可以查看此链接以查看其他提供商的列表:

phpmailer仅用于电子邮件…通常第三方SMS插件要求电子邮件是否转发到手机?否,电子邮件发送到电子邮件id(如果我提供电子邮件id),但我想向手机发送消息(如果我提供手机号)如果我只知道手机号,我如何知道服务提供商的电子邮件地址?我刚刚更新了帖子。看看它是否能帮助你。