【发布时间】:2022-01-06 01:35:47
【问题描述】:
我正在尝试使用 Codeigniter 发送 HTml 邮件。 邮件发送正常但我得到的结果如下
$config = array(
'protocol' => 'smtp',
'smtp_host' => 'ssl://smtp.googlemail.com',
'smtp_port' => '465',
'smtp_user' => 'no-reply@xxxxx.in',
'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;
【问题讨论】:
-
请添加邮件内容的添加方式
-
@AaronJunker 当我使用邮件协议时,我得到了正确的格式
标签: php codeigniter email smtp