SMTP使用localhost中的codeigniter发送电子邮件,但不在Web主机上发送

时间:2013-04-15 13:26:20

标签: php smtp fsockopen

我已经设法让我的sendmail功能在我的本地主机上工作,但是当我将它上传到我的虚拟主机时,我会看到一长串错误。我正在使用gmail,它在本地工作正常。我认为这与SSL有关。这是我收到的错误:

A PHP Error was encountered

Severity: Warning

Message: fsockopen() [function.fsockopen]: unable to connect to ssl://smtp.gmail.com:465 (Connection timed out)

Filename: libraries/Email.php

Line Number: 1689

A PHP Error was encountered

Severity: Warning

Message: fwrite(): supplied argument is not a valid stream resource

Filename: libraries/Email.php

Line Number: 1846

这个清单一直在继续。这是我的函数,它发送电子邮件和使用的配置数组:

            $config = array(
                'protocol' => "smtp",
                'smtp_host' => "smtp.gmail.com",
                'smtp_port' => 465,
                'smtp_user' => "removed",
                'smtp_pass' => "removed",
                'mailtype'  => "html",
                'charset'   => "iso-8859-1"
            );


            //generate a random key
            $key = md5(uniqid());

            //load email library and set config settings
            $this->load->library("email", $config);//array("mailtype"=>"html")
            $this->email->set_newline("\r\n");
            $this->load->model("model_users");
            $this->email->initialize($config);

我的托管服务是123-reg.co.uk,我认为这与SSL有关。任何帮助都会很棒。

0 个答案:

没有答案