I'm making a simple PHP mail sender to send an image to multiple addresses at a time. Don't know why, but the emails keep on arriving at the SPAM folder, no matter what email manager I send them...
Here's how I call the PHP mail sender file:
$.ajax({ url: 'mail_sender.php?receiver=' + receiver + '&=lang' + lang,
success: function (response)
{
console.log('Mails ' + response);
}
});
And this is my PHP file structure:
<?php
// Reciever
$_to = $_GET["receiver"];
$_lang = $_GET["lang"];
// subject
$subject = 'My Subject';
// sender
$sender = "sender@sender.es";
// message
$message = '
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<head>
<META name="generator" content="HTML Tidy for Linux/x86 (vers 25 March 2009), see www.w3.org">
<TITLE></TITLE>
<META http-equiv="Content-Type" content="text/html; charset=us-ascii">
</head>
<body>
<img src='."https://www.mysite.es/demo/img/emails/imagen_".$_lang.".jpg".' />
</body>
</html>
';
// To send HTML mail, the Content-type header must be set
$headers = "Reply-To: <sender@sender.es> \r\n";
$headers .= "Return-Path: <sender@sender.es>" . "\r\n";
$headers .= "From: <sender@sender.es>" . "\r\n";
$headers .= "Organization: My organization" . "\r\n";
$headers .= "MIME-Version: 1.0" . "\r\n";
$headers .= "Content-type: text/html; charset=utf-8" . "\r\n";
$headers .= "X-Priority: 3" . "\r\n";
$headers .= "X-Mailer: PHP/". phpversion();
// Mail it
$ret = mail($_to, $subject, $message, $headers);
if ( $ret == '' || $ret )
{
echo $ret;
}else{
echo $ret;
}
?>
Can anyone give some clues?
Thank you very much!