无法使用PEAR库php发送电子邮件

时间:2018-09-12 11:14:37

标签: php email pear

我正在尝试使用PHP PEAR库发送电子邮件。这是我的代码:

include('Mail.php');
$recipients = $email;
$headers['From']    = 'myemail@mail.net';
$headers['To']      = $email;
$headers['Subject'] = 'Subject';
$body = "This is text message"

// Create the mail object using the Mail::factory method
$mail_object =& Mail::factory("smtp", array("host" => "myhost.net", "port" => "25", "auth" => true, "username" => "myusername@mail.net", "password" => "mypassword")); //Code gets stuck on this line

$mail_object->send($recipients, $headers, $body);

这是在PHP 7.0上进行的。现在,我在新服务器上安装了PHP 7.2,此代码不再起作用。已安装PEAR。代码卡在注释行中,但不会返回任何错误消息。我在做什么错了?

0 个答案:

没有答案