无法使用smtp和PHP邮件程序向gmail帐户发送电子邮件

时间:2014-08-07 14:24:18

标签: email smtp gmail phpmailer

我有PHP邮件程序。当我运行它发送电子邮件到雅虎帐户它工作正常。但是,当我发送到Gmail帐户时,它还没有被发送。即使是email_debugger也说它已经成功发送了。有人可以帮帮我吗?

这是我的邮件配置

$this->load->library('email');
$config['useragent']        = 'PHPMailer';              // Mail engine switcher:   'CodeIgniter' or 'PHPMailer'
$config['protocol']         = 'smtp';                   // 'mail', 'sendmail', or 'smtp'
$config['mailpath']         = 'PHPMailer';
$config['smtp_host']        = 'domain.com';
$config['smtp_user']        = 'example@domain.com';
$config['smtp_pass']        = 'example';
$config['smtp_port']        = 25;
$config['smtp_timeout']     = 65;                        // (in seconds)
$config['smtp_crypto']      = 'ssl';                    // '' or 'tls' or 'ssl'
$config['smtp_debug']       = 3;                        // PHPMailer's SMTP debug info  level: 0 = off, 1 = commands, 2 = commands and data, 3 = as 2 plus connection status, 4 = low level data output.
$config['wordwrap']         = true;
$config['wrapchars']        = 76;
$config['mailtype']         = 'html';                   // 'text' or 'html'
$config['charset']          = 'utf-8';
$config['validate']         = true;
$config['priority']         = 3;                        // 1, 2, 3, 4, 5
$config['crlf']             = "r\n";                     // "\r\n" or "\n" or "\r"
$config['newline']          = "r\n";                     // "\r\n" or "\n" or "\r"
$config['bcc_batch_mode']   = false;
$config['bcc_batch_size']   = 200;
$config['mailtype'] = 'html';
$this->email->initialize($config);

$subject       = 'Design Consulting oleh '.$nama;
$this->email->from($email, $nama);

$this->email->to($to);

$this->email->subject($subject);

$this->email->message($mail_body);  

if ($this->email->send())
        {
            $this->session->set_flashdata('message', '<div class="success">Thank you, your message successfully sent to our email Management.</div>');
         //echo $this->email->print_debugger(); 
            redirect($this->web_url.'/consulting/');

        }
        else
        {
            $this->session->set_flashdata('message', '<div class="error">Something went wrong, please try again or contact the helpdesk.</div>');
            redirect($this->web_url.'/consulting/');

        }

任何人都可以帮助我吗?感谢。

0 个答案:

没有答案