-4
I’m using the same script I’ve used on other sites but it seems this site isn’t sending emails.
If I send an email through virtual control panel min email is received in outlook in spam but gmail does not even arrive.
What should I do?
<?php
$subject = "example";
$from ='[email protected]';
$to ='<[email protected]>';
$bcc = null; // Esconder endereços de e-mails.
$cc = null; // Qualquer destinatário pode ver os endereços de e-mail especificados nos campos To e Cc.
$message = "<!DOCTYPE html>
<html>
<head>
<style>
table {
width:100%;
}
table, th, td {
border: 1px solid black;
border-collapse: collapse;
}
th, td {
padding: 5px;
text-align: left;
}
table#t01 tr:nth-child(even) {
background-color: #eee;
}
table#t01 tr:nth-child(odd) {
background-color:#fff;
}
table#t01 th {
background-color: black;
color: white;
}
</style>
</head>
<body>
<table id='t01'>
<tr>
<th>Lisguagens uteis</th>
<th>Sites</th>
<th>Prioridade</th>
</tr>
<tr>
<td>HTML</td>
<td>http://www.w3schools.com/</td>
<td>1</td>
</tr>
<tr>
<td>CSS</td>
<td>http://www.w3schools.com/</td>
<td>2</td>
</tr>
<tr>
<td>JAVASCRIPT</td>
<td>https://codecademy.com/learn/javascript</td>
<td>3</td>
</tr>
<tr>
<td>PHP</td>
<td>https://external.codecademy.com/learn/php</td>
<td>4</td>
</tr>
</table>
<table id='t01'>
<tr>
<th>Nota:</th>
</tr>
<tr>
<th>text exemple</th>
</tr>
</body>
</html>";
$headers = sprintf( 'Date: %s%s', date( "D, d M Y H:i:s O" ), PHP_EOL );
$headers .= sprintf( 'Return-Path: %s%s', $from, PHP_EOL );
$headers .= sprintf( 'To: %s%s', $to, PHP_EOL );
$headers .= sprintf( 'Cc: %s%s', $cc, PHP_EOL );
$headers .= sprintf( 'Bcc: %s%s', $bcc, PHP_EOL );
$headers .= sprintf( 'From: %s%s', $from, PHP_EOL );
$headers .= sprintf( 'Reply-To: %s%s', $from, PHP_EOL );
$headers .= sprintf( 'Message-ID: <%s@%s>%s', md5( uniqid( rand( ), true ) ), $_SERVER[ 'HTTP_HOST' ], PHP_EOL );
$headers .= sprintf( 'X-Priority: %d%s', 3, PHP_EOL );
$headers .= sprintf( 'X-Mailer: PHP/%s%s', phpversion( ), PHP_EOL );
$headers .= sprintf( 'Disposition-Notification-To: %s%s', $from, PHP_EOL );
$headers .= sprintf( 'MIME-Version: 1.0%s', PHP_EOL );
$headers .= sprintf( 'Content-Transfer-Encoding: 8bit%s', PHP_EOL );
$headers .= sprintf( 'Content-Type: text/html; charset="iso-8859-1"%s', PHP_EOL );
mail(null, $subject, $message, $headers);
echo("enviado");
?>
Add your script to the question.
– user28595
The first parameter of the "mail" function is the recipient, you are passing null to it.
– Kayo Bruno
but I’m going through the headers, either way if I put there the variable that contains the email it keeps sending itself
– Amadeu Antunes