mail() function always go to spam
Posted: 2020-09-06 18:38
Hi, can anyone diagnose why this code is always leading this email to spam? is there any alternative to the mail() function that would be better for this purpose?
Thank you.
Thank you.
Code: Select all
$to = $email;
$subject = $name." - Bem Vindo ao Fitbook";
$message = "
<html>
<head>
<title>Bem vindo ao Fitbook!</title>
</head>
<body>
<div style='text-align: center'><img style='width: 250px' src='https://fitbookapp.net/fitbook/logon.png?c=9' /></div>
<table align='center'>
<p><br/></p>". "\n". "\n". "\n". "\n". "\n"."
<tr>
<td align='center'> Olá ".$name.", bem vindo ao Fitbook App!</td>
</tr>
<p><br/></p>". "\n" . "
<tr>
<td align='center'> Seguem abaixo suas credenciais de acesso: </td>
</tr>
</table>
<p><br/></p>". "\n". "\n". "\n". "\n". "\n". "\n". "\n". "\n"."
<table align='center'>
<tr>
<th align='center'>Usuário</th>
</tr>
<tr>
<td align='center'>".$email."</td>
</tr>
<p> </p>
</table>
<table align='center'>
<tr>
<th align='center'>Senha</th>
</tr>
<tr>
<td align='center'>fitbook</td>
</tr>
</table>
<p><br/></p>". "\n". "\n". "\n". "\n". "\n". "\n". "\n". "\n"."
<table align='center'>
<tr>
<th align='center'>Acessar App</th>
</tr>
<tr>
<td align='center'>https://fitbookapp.net/fitbook/</td>
</tr>
<p> </p>
</table>
<p><br/></p>". "\n". "\n". "\n". "\n". "\n". "\n". "\n". "\n"."
<table align='center'>
<tr>
<th align='center'>Contato</th>
</tr>
<tr>
<td align='center'>[email protected]</td>
</tr>
</table>
<p> </p>
<div style='text-align: center'><img style='width: 25px' src='https://fitbookapp.net/fitbook/favicon.png?c=9' /></div>
</body>
</html>
";
// Always set content-type when sending HTML email
$headers = "MIME-Version: 1.0" . "\r\n";
$headers .= "Content-type:text/html;charset=UTF-8" . "\r\n";
// More headers
$headers .= 'From: <[email protected]>' . "\r\n";
mail($to,$subject,$message,$headers);