-1

私はこのコードを実行しようとしています:

    $this->load->library('email');

    $this->email->from('anu1488@gmail.com', 'Anudeep');

    $this->email->to('anu1488@gmail.com');

    $this->email->subject('Email Test');
    $this->email->message('Testing the email class.');

    $this->email->send();

    echo $this->email->print_debugger();

送信しようとすると、次のエラーが発生しました。

A PHP Error was encountered
Severity: Warning
Message: mail() [function.mail]: Failed to connect to mailserver at "localhost" port 25, verify your "SMTP" and "smtp_port" setting in php.ini or use ini_set()    
Filename: libraries/Email.php
Line Number: 1553

これは何が原因ですか?どうすれば解決できますか?

4

3 に答える 3

0

メールを送信するための SMTP サーバー (メール サーバー) がローカル マシンに設定されていないようです。libraries/Email.phpファイルが、有効なメール サーバーが存在しないホスト名/ポートを参照しているようです。

于 2012-12-20T05:05:14.203 に答える
0

これを試してください、それは私のために働いています....

$config = Array(
                    'protocol' => 'smtp',
                    'smtp_host' => 'ssl://smtp.googlemail.com',
                    'smtp_port' => 465,
                    'smtp_user' => 'user@gmail.com',
                    'smtp_pass' => 'user password',
                );


                $this->load->library('email', $config);
                $this->email->set_newline("\r\n");

                $this->email->from('user@gmail.com', 'User');
                $this->email->to(sample@gmail.com);


                $this->email->subject('Email Test');
                $this->email->message('Testing the email class.');

                if ($this->email->send()) {
                    $data['error'] = "Your email was sent";
                } else {
                    show_error($this->email->print_debugger());
                }

次にphp.iniを開き、extension=php_openssl.dllこの行に移動してコメントを外します。その後、wamp サーバーを再起動します。

于 2013-01-28T07:28:15.383 に答える
0
**I guess you need to setup email configuration and port number in  config/email  .**

 $config['protocol']='smtp';
 $config['smtp_host']='ssl://smtp.googlemail.com';
 $config['smtp_port']='465';
 $config['smtp_timeout']='30';
 $config['smtp_user']='abhi.abc@gmail.com';
 $config['smtp_pass']='password';
 $config['charset']='utf-8';
 $config['newline']="\r\n";
 $config['mailtype'] = "html";


**if every thing is correct from your side then you can just change 'smtp_port' number and then check it definitely it will work`enter code here`.**
于 2012-12-20T06:11:57.187 に答える