提问人:Yadhu Babu 提问时间:11/29/2021 最后编辑:Yadhu Babu 更新时间:12/1/2021 访问量:48
Html 邮件无法使用 CodeIgniter SMTP 发送
Html mail can't send using CodeIgniter SMTP
问:
我正在尝试使用 Codeigniter 发送 HTml 邮件。 邮件发送正常,但我得到的结果如下
$config = array(
'protocol' => 'smtp',
'smtp_host' => 'ssl://smtp.googlemail.com',
'smtp_port' => '465',
'smtp_user' => '[email protected]',
'smtp_pass' => 'Mypassword',
'mailtype' => 'html',
'charset' => 'utf-8',
'newline' => "\r\n",
'priority' => '1'
);
$this->load->library('email',$config);
$this->email->set_newline("\r\n");
$this->email->from($from_email, 'Doctor M');
$this->email->to($to_email);
$this->email->subject('Doctor M | Verification');
$this->email->message($content);
if($this->email->send()) {echo "ok";}
$content_head = '<html>
<head>
<title>Doctor M</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body bgcolor="#ffc107" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0" style="background:#ffc107;">
<table bgcolor="#ccccff" width="800" cellpadding="0" cellspacing="0" border="0" align="center" cellspacing="0" style="background: #fff;padding: 50px;border: 1px solid #dddddd;">
<tr>
<td align="left" valign="top">
<img src="'.base_url().'assets/media/images/logo.png" alt="'.base_url().'" width="75" height="116" border="0px normal #000;"></td>
</tr>
<tr><td height="10"></td></tr>
<tr>
<td width="800" align="left" valign="top"><table width="600" border="0" cellspacing="0" cellpadding="0">
<tr>
<td style="font-family:Arial, Helvetica, sans-serif; font-size:13px; color:#666; padding: 0 10px;">';
$content_tail = '</td>
</tr>
</table></td>
</tr>
<tr>
<td align="left" valign="top">
</td>
</tr>
<tr>
<td align="left" valign="top" bgcolor="#fff" style="font-family:Arial, Helvetica, sans-serif; font-size:11px; color:#000; padding:5px 10px;">©'.date('Y').'. '.base_url().' . All Rights Reserved.</td>
</tr>
</table>
</body>
</html>';
$content = $content_head.'<p>Hi <strong> '.$this->input->post('name'). '</strong><br></p>';
$content .= '<p> </p>';
$content .= '<p><b>You have successfully registered to Ayush Hardtalk.</b></p>';
$content .= '<p> </p>';
$content .= '<p>Please click the link below to join the event: <br></p>';
$content .= '<p>'.$this->input->post('link'). '</p>';
$content .= '<p><table cellspacing="0">';
$content .= '<tr><td><br>We hope you will continue to associate with us <td><td>';
$content .= '</table><p>';
$content .= '<p>Holistically yours<br/>';
$content .= '<p> </p>';
$content .= '<p> </p>';
$content .= '<p>Team Ayush valley<br/>';
$content .= '</p><br/>'.$content_tail;
答:
0赞
Srinivas Mahindrakar
12/1/2021
#1
将您的 HTML 电子邮件内容放在 PHP 文件中。
$data['email_param'] = ['name' => 'srinivas'];
$content = $this->load->view('html_email_file', $data, TRUE);
$this->email->message($content);
评论