PHP邮件发送速度很慢
问题描述:
我有一个带有inmotion托管的VPS,并且我发送了一封确认邮件,但是它发送的邮件太多了,当我发送邮件时,如何构建html代码的最佳方式,如何我可以提高表现吗?PHP邮件发送速度很慢
这是我的代码。
$subject = 'Mail activation';
$body = '
<html>
<head>
<base target="_blank">
</head>
<body>
<table style="max-width:800px; margin:0 auto; font-family: Arial, Helvetica, sans-serif;" cellspacing="0" cellpadding="10">
<thead style="border-bottom:1px solid #DDD;">
<tr>
<td align="center" style="border-bottom:1px solid #DDD;">
<img src="http://p.unid.com/img/logoSASENegro.png" alt="" height="45" width="150"/>
</td>
</tr>
</thead>
<tbody>
<tr>
<td>
Hi classmate
</td>
</tr>
<tr>
<td>
Press the following link.
</td>
</tr>
<tr>
<td>
www.google.com
</td>
</tr>
<tr>
<td>
You data:
</td>
</tr>
<tr>
<td>
ID - <b>'.$ids.'</b><br/>
Password - <b>'.$pass.'</b><br/>
</td>
</tr>
<tr>
<td>
Don't response this email.
</td>
</tr>
</tbody>
</table>
</body>
</html>
';
$headers = "MIME-Version: 1.0\r\n";
$headers .="Content-type: text/html; charset=utf-8\r\n";
$headers .= "From: Contacto SASE <[email protected]>\r\n";
if(mail($emailC, $subject, $body, $headers))
答
在某些服务器上,邮件()发送的邮件确实很慢。您的问题与邮件内容无关,但与您的托管服务提供商有关。作为一种可能的解决方案,您可以将脚本切换为通过不同的SMTP服务器发送邮件(例如gmail:Send email using the GMail SMTP server from a PHP page)。
您的语法错误。看看'不要回复这封电子邮件'。你的字符串在那里结束 – Joshua
性能与服务器/ MTA设置有关,而不是代码。 (→关题)。考虑一个邮件类和一个适当的SMTP中继。 – mario