Email Pear邮件(Gmail SMTP)-无法连接套接字
我试图使用Pear Mail向gmail发送电子邮件,但出现错误:Email Pear邮件(Gmail SMTP)-无法连接套接字,email,smtp,gmail,pear,Email,Smtp,Gmail,Pear,我试图使用Pear Mail向gmail发送电子邮件,但出现错误: Failed to connect to ssl://smtp.gmail.com:465 [SMTP: Failed to connect socket: Unable to find the socket transport "ssl" - did you forget to enable it when you configured PHP? (code: -1, response: )] 这是我的密码: <?p
Failed to connect to ssl://smtp.gmail.com:465 [SMTP: Failed to connect socket:
Unable to find the socket transport "ssl" - did you forget to enable it when you
configured PHP? (code: -1, response: )]
这是我的密码:
<?php
require_once 'Mail.php';
$from = "username@gmail.com";
$to = "username@domain.com";
$subject = "Subject";
$body = "Hello!";
$host = "ssl://smtp.gmail.com";
$port = "465";
$username = "username@gmail.com";
$password = "password";
$headers = array (
'From' => $from,
'To' => $to,
'Subject' => $subject);
$smtp = Mail::factory(
'smtp',
array (
'host' => $host,
'port' => $port,
'auth' => true,
'username' => $username,
'password' => $password));
$mail = $smtp->send($to, $headers, $body);
if (PEAR::isError($mail)) {
echo $mail->getMessage();
} else {
echo "Message sent successfully!";
}
?>
我读过几乎所有关于我的问题的书,我试过phpmailer,我发现很难,我试过删除php.ini上的extension=php_openssl.dll上的注释,重新启动了apache,将465改为587左右,但运气不好!Windows防火墙未打开。我做错了什么?请帮忙
谢谢 这个已经开始工作了!抱歉,我编辑了错误的php.in文件;它应该是bin文件夹中的一个。这个已经在工作了!抱歉,我编辑了错误的php.in文件;它应该在bin文件夹中