I registered three emails in my database, however when I send the email it falls into the spam box.
I do not know what to do to avoid falling as spam.
In case the content of the email is an HTML email marketing. (containing photos and content written in html).
In case the code is very simple, I submit a form HTML and get it by PHP.
The host used to send is: link
I do not want a guarantee that the email will never fall into the spam box, but rather the reason why it is falling into the spam box.
This is not a question of opinion, but of experience, so if you have no experience of why this is happening, please do not respond.
I believe I was not clear on the question, so I decided to edit it.
The question is simple. Why in this code do emails fall as spam? What do I need to change in the code so I do not fall as spam? The problem of falling as spam, could be the HTML layout?
<?php
include_once "conexao.php";
$email = $_POST['email'];
$nome = $_POST['nome'];
$assunto = $_POST['assunto'];
$arquivo = $_FILES['arquivo'];
$arquivo = file_get_contents($_FILES['arquivo']['tmp_name']);
$sql = "SELECT 'id', 'email' FROM 'mailmarketing' ";
$query = $mysqli->query($sql);
echo '<table><tr><td>E-mail: </td></tr>';
while ($dados = $query->fetch_array()) {
$destino = $dados['email'];
// É necessário indicar que o formato do e-mail é html
$headers = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
$headers .= 'From: '.$nome.' <'.$email.'>';
//$headers .= "Bcc: $EmailPadrao\r\n";
echo '<tr><td>' . $dados['E-mail'] . '</td><td>';
$enviaremail = mail($destino, $assunto, $arquivo, $headers, "-f$email");
if($enviaremail){
echo "<b>E-mail enviado com sucesso!</b>";
//echo " <meta http-equiv='refresh' content='1;URL=index.php'>";
} else {echo "<b>erro ao enviar o e-mail!</b></br>";}
echo "</td></tr>";
}//echo 'Registros encontrados: ' . $query->num_rows;
echo "</table>";
?>