dongzhong5833 2014-01-22 10:37 采纳率: 0%
浏览 21
已采纳

PHP不会使用mail.php发送邮件

i am sending a mail using php mail file.but i am getting error.this is my code and error

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 = 'email';
$to = 'email';

 1. List item

$subject = 'Hi!';


$headers = array(

    'To' => $to,
    'Subject' => $subject,
    'from' => $from 
);

$smtp = @Mail::factory('smtp', array(
        'host' => 'ssl://smtp.gmail.com',
        'port' => '465',
        'auth' => true,
        'username' => 'email',
        'password' => 'password'
    ));

$mail = @$smtp->send($to, $headers);

if (@PEAR::isError($mail)) {
    echo('<p>' . $mail->getMessage() . '</p>');
} else {
    echo('<p>Message successfully sent!</p>');
}

?>

this all error

Strict Standards: Non-static method PEAR::isError() should not be called statically, assuming $this from incompatible context in C:\xampp\php\pear\Net\SMTP.php on line 491

Strict Standards: Non-static method PEAR::isError() should not be called statically, assuming $this from incompatible context in C:\xampp\php\pear\Net\SMTP.php on line 265

Strict Standards: Non-static method PEAR::raiseError() should not be called statically, assuming $this from incompatible context in C:\xampp\php\pear\Net\SMTP.php on line 267

  • 写回答

3条回答 默认 最新

  • dsy48837 2014-01-22 10:59
    关注

    it seems that your php isn't configured to use SSL, contact your provider, or edit your php.ini (/etc/php.ini) and enable it.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(2条)

报告相同问题?

悬赏问题

  • ¥20 sub地址DHCP问题
  • ¥15 delta降尺度计算的一些细节,有偿
  • ¥15 Arduino红外遥控代码有问题
  • ¥15 数值计算离散正交多项式
  • ¥30 数值计算均差系数编程
  • ¥15 redis-full-check比较 两个集群的数据出错
  • ¥15 Matlab编程问题
  • ¥15 训练的多模态特征融合模型准确度很低怎么办
  • ¥15 kylin启动报错log4j类冲突
  • ¥15 超声波模块测距控制点灯,灯的闪烁很不稳定,经过调试发现测的距离偏大