1

请检查我的以下代码,以便从我的 gmail 帐户向同一个 gmail 帐户发送电子邮件。当我运行它时,它说电子邮件已发送。但我在收件箱中找不到任何此类内容。谁能提出问题可能是什么?

$config = Array(
        'protocol' => 'smtp',
        'smtp_host' => 'ssl://smtp.googlemail.com',
        'smtp_port' => 465,
        'smtp_user' => 'koolpraju@gmail.com',
        'smtp_password' => '****',
        'mailtype' => 'html',
        'charset' => 'iso-8859-1'
    );

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


    $this->email->set_newline("\r\n");

    $this->email->from('koolpraju@gmail.com','Prajakta');
    $this->email->to('koolpraju@gmail.com');
    $this->email->subject('This is a test email');
    $this->email->message('It is working. Great!! yey');

    if($this->email->send())
    {
        echo 'Your email was sent successfully';

    }
    else
    {
        show_error($this->email->print_debugger());
    }

我让 Xampp 与 Mercury 一起运行,并设置了 Mercury S SMTP 服务器参数。我真的不明白为什么电子邮件没有通过?有人可以帮我解决这个问题吗?

4

1 回答 1

0
function sendMail()
{
    $config = Array(
  'protocol' => 'smtp',
  'smtp_host' => 'ssl://smtp.googlemail.com',
  'smtp_port' => 465,
  'smtp_user' => 'xxx@gmail.com', // change it to yours
  'smtp_pass' => 'xxx', // change it to yours
  'mailtype' => 'html',
  'charset' => 'iso-8859-1',
  'wordwrap' => TRUE
);

        $message = '';
        $this->load->library('email', $config);
      $this->email->set_newline("\r\n");
      $this->email->from('xxx@gmail.com'); // change it to yours
      $this->email->to('xxx@gmail.com');// change it to yours
      $this->email->subject('Resume from JobsBuddy for your Job posting');
      $this->email->message($message);
      if($this->email->send())
     {
      echo 'Email sent.';
     }
     else
    {
     show_error($this->email->print_debugger());
    }

}
于 2014-07-14T10:53:41.563 回答