我有一个小型的php网站,它向美国的任何给定号码发送短信。我尝试使用它发送自己的文本,但没有收到它。我把它寄给了我堂兄的号码,他收到了。我使用简单移动作为我的载体,我的堂兄使用T-mobile。可能是这个消息被转换为短消息?如果是这样,有什么方法可以解决它吗?因为将来我需要向任何给定的号码发送短信,如果所有目标收件人都收到文本而不必启用任何内容,那将是很好的。
这是我的代码:
require 'PHPMailer-master/PHPMailerAutoload.php';
// Instantiate Class
$mail = new PHPMailer();
// Set up SMTP
$mail->IsSMTP(); // Sets up a SMTP connection
$mail->SMTPDebug = 2; // This will print debugging info
$mail->SMTPAuth = true; // Connection with the SMTP does require authorization
$mail->SMTPSecure = "tls"; // Connect using a TLS connection
$mail->Host = "smtp.gmail.com";
$mail->Port = 587;
$mail->Encoding = '7bit'; // SMS uses 7-bit encoding
// Authentication
$mail->Username = "example@gmail.com"; // Login
$mail->Password = "password"; // Password
// Compose
$mail->Subject = "Testing"; // Subject (which isn't required)
$mail->Body = "Testing"; // Body of our message
// Send To
$mail->AddAddress( "phoneNumber@tmomail.net" ); // Where to send it
var_dump( $mail->send() ); // Send!