When i try to send an email through mail() in PHP it doesn't send email but sometimes when it sends an email it says that email is sent but i don't receive any email
When i try to send an email through mail() in PHP it doesn't send email but sometimes when it sends an email it says that email is sent but i don't receive any email
Did you check the spam folder?
Yes , i have checked sir but still not working kindly see my issue.
Could you provide the code you are using? Did you try to send emails to a different email (of a different email provider)?
This code i m using sir:
<?php
$to="parretti.francescoit@gmail.com";
$subject="My Subject";
$message="My HTML Based Message";
$header = "";
$header .= "Reply-To: Francesco <francescoparretti@altervista.org>\r\n";
$header .= "Return-Path: Francesco <francescoparretti@altervista.org>\r\n";
$header .= "From: Francesco <francescoparretti@altervista.org>\r\n";
$header .= "Organization: Francesco \r\n";
$header .= "MIME-Version: 1.0\r\n";
$header .= "Content-Type: text/html; charset=utf-8\r\n";
$header .= "X-Mailer: PHP/" . phpversion()."\r\n";
$header .= "Content-Transfer-Encoding: 7bit\n\n";
if (mail($to, $subject, $message, $header)) {
echo "Message sent!";
} else {
echo "Message failed sending!";
}
?>
I'm also having intermittent issues with the mail() function. Every time my script runs it claims the email has been successfully sent, however I rarely receive an email in my Inbox.
Code snippet below:
$to = "javelin***@iinet.net.au"; // Obfuscated email address
$subject = "Javelin | " . _INPUT('name') . " has made contact";
$message = stripslashes(commentCheck(_INPUT('comment'))) . "<br>";
$header = "From: " . _INPUT('email') . "\r\n";
$header .= "Content-type: text/html; charset=iso-8859-1\r\n";
mail($to, $subject, $message, $header);
echo "<p class=\"msg\">Thank you, " . _INPUT('name') . ". Your message has been successfully sent. You should receive a response shortly.</p>\n";
Any non-standard functions are simply there to validate the user's form data.
Last edited by javelin; 05-27-2015 at 01:15 PM.
You mail has been probably blocked by a antispam filter.
I see that you're sending an HTML mail, but the content is not a complete HTML page (at least <HTML> and <BODY> are missing). Try to send a more compliant HTML page.
And when you set a Content-Type header you should add a MIME-Version header to be compliant with specifications.
"Over thinking, over analyzing separates the body from the mind."