html邮件返回代码,发送HTML电子邮件结果显示HTML源代码(Codeigniter电子邮件类)...

我在通过电子邮件发送的电子邮件类中发送电子邮件问题,在电子邮件中显示源HTML代码而不是呈现的HTML视图。为了进行测试,我目前在Windows上的XAMPP上使用CI,并使用Gmail SMTP发送到相同的Gmail地址。发送HTML电子邮件结果显示HTML源代码(Codeigniter电子邮件类)

发送电子邮件的功能如下:

$config = Array(

'protocol' => 'smtp',

'smtp_host' => 'ssl://smtp.googlemail.com',

'smtp_port' => 465,

'smtp_user' => '[email protected]',

'smtp_pass' => 'mygmailpassword',

);

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

$this->email->from($this->config->item('webmaster_email', 'tank_auth'), $this->config->item('website_name', 'tank_auth'));

$this->email->reply_to($this->config->item('webmaster_email', 'tank_auth'), $this->config->item('website_name', 'tank_auth'));

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

$this->email->subject(sprintf($this->lang->line('auth_subject_'.$type), $this->config->item('website_name', 'tank_auth')));

$this->email->message($this->load->view('email/'.$type.'-html', $data, TRUE));

$this->email->set_alt_message($this->load->view('email/'.$type.'-txt', $data, TRUE));

$this->email->set_newline("\r\n"); // require this, otherwise sending via gmail times out

$this->email->send();

是没有问题越来越发送的文字版本。加载的视图是一个将通过电子邮件发送出去的html文件。

Welcome to <?php echo $site_name; ?>!

Welcome to <?php echo $site_name; ?>!

Thanks for joining <?php echo $site_name; ?>. We listed your sign in details below, make sure you keep them safe.

To verify your email address, please follow this link:

Finish your registration...

Link doesn't work? Copy the following link to your browser address bar:

<?php echo site_url('/auth/activate/'.$user_id.'/'.$new_email_key); ?>

Please verify your email within <?php echo $activation_period; ?> hours, otherwise your registration will become invalid and you will have to register again.

<?php if (strlen($username) > 0) { ?>Your username: <?php echo $username; ?><?php } ?>

Your email address: <?php echo $email; ?>

<?php if (isset($password)) { /* ?>Your password: <?php echo $password; ?><?php */ } ?>

Have fun!

The <?php echo $site_name; ?> Team

任何想法如何让HTML电子邮件发送呈现,而不是显示其源代码?

2011-06-08

Nyxynyx

+0

你不能有PHP在一封电子邮件中身体。我也不确定你需要或标签。 –

2011-06-08 04:13:13

+0

@Nik:PHP是*生成*发送的HTML,它实际上不在电子邮件正文中。 –

2011-06-08 04:16:41

+0

不是电子邮件中HTML的第二个代码段吗?那里有PHP。显然,第一个代码段是一代。 –

2011-06-08 04:18:41

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值