我正在编写一个使用 PHP 代码通过电子邮件发送电话号码的小型 Web 应用程序(拥有电话号码的人将其视为短信,当然不是电子邮件)。每个电话服务都有电子邮件到文本。例如,美国的 Verizon 使用@vtext.com。
我的问题是,SMS 上的 FROM 总是说“6245”,这显然是来自 Verizon 电子邮件域 (vtext.com) 的 SMS 的标准。我可以在代码中使用更易于阅读的 From 而不是这个看似随机的数字来更改它吗?
这是我使用 PHP 邮件程序的代码:
$from = $_POST['email'];
$from = filter_var($from, FILTER_SANITIZE_EMAIL);
$message .= $guest . ' waiting at Office. Checked in at ';
$message .= strftime("%l:%M %p (%A %b %e, %Y)", time());
// PHP SMTP mail version
$mail = new PHPMailer();
$result = mysql_query("SELECT * FROM users WHERE onduty = 1");
$recipients = array();
while ($row = mysql_fetch_array($result)) {
$recipients[] = $row['phone'] . $row['carrier'];
}
foreach ($recipients as $email) {
$mail -> AddAddress($email);
}
$from_name = "Riverstone Notification";
$subject = "Person in Office";
$mail -> IsSMTP();
$mail -> Host = "relay-hosting.secureserver.net";
$mail -> Port = 25;
$mail -> SMTPAuth = false;
$mail -> Username = "EMAIL_USER";
$mail -> Password = "EMAIL_PASS";
$mail -> FromName = $from_name;
$mail -> From = $from;
$mail -> Subject = $subject;
$mail -> Body = $message;
$result = $mail -> Send();