【问题标题】:Empty email to Yahoo users with Codeigniter使用 Codeigniter 向 Yahoo 用户发送空电子邮件
【发布时间】:2014-03-21 15:02:44
【问题描述】:

当雅虎用户在我的网站注册时,我尝试向他们发送电子邮件,但电子邮件为空。

所以我尝试编辑电子邮件类并将 send_multipart 变量设置为 FALSE。但没有任何改变。

我使用我的 smtp 服务器和其他电子邮件客户端,一切正常。

有什么想法吗?

我这样发送电子邮件:

$email_content = array(
'email' => $email,
'subject' => lang('email_subject'),
'template' => 'auth/email/email_template'
);

$this->send_mail($email_content);

电子邮件模板:

<html>
<body>
<h1>title</h1>
<p>welcome, this is a test message</p>
</body>
</html>

在雅虎邮箱中,我看到了:

<h1></h1>
<p></p>

还有我的 send_mail 函数:

public function send_mail($data)
{
    $this->load->library('email');

    $message = $this->load->view($data['template'], $data, true);
    $this->email->from('no-reply@mysite.com', 'Mysite.com');
    $this->email->to($data['email']);
    $this->email->subject('Mysite.com - ' . $data['subject']);
    $this->email->message($message);
    if ($this->email->send())
    {
        return true;
    }else
    {
        return false;
    }
}

【问题讨论】:

  • 为什么是这个负值?
  • 建议?当然。提问时,请务必包含人们为您提供良好、有用的答案所需的所有信息。没有任何代码,没有任何关于应该发生什么以及正在发生什么的详细解释......你不太可能得到回应。
  • 邮件内容是什么?如果您查看 Yahoo (luxsci.com/blog/…) 中的电子邮件来源,您会看到什么?
  • 刚刚编辑了我的初始帖子

标签: php codeigniter email yahoo


【解决方案1】:

设置邮件类型为html:

$this->load->library('email');
// set mail type with this line: 
$this->email->set_mailtype( 'html' );

【讨论】:

    猜你喜欢
    • 2013-06-02
    • 2010-12-19
    • 2020-01-17
    • 2017-01-26
    • 1970-01-01
    • 2013-04-29
    • 2017-12-07
    • 2014-12-26
    • 1970-01-01
    相关资源
    最近更新 更多