Eslam Zedan
28 Feb 2022
PHP & Mysql
Hello,
I want to send an email using the PHP mail function not SMTP (I know that is not good practice but the Client request that).
the emails go to the junk/spam folder is there any way to make it goes to the inbox as a normal email?
I tried the solution here //stackoverflow.com/questions/5935087/how-do-i-prevent-mails-sent-through-php-mail-from-going-to-spam
but it goes to junk
here is my code
$to_email = 'to@domain.com';
$subject = 'Testing PHP Mail';
$message = 'This mail is sent using the PHP mail function';
$headers = "From: myplace@example.com\r\n";
$headers .= "Reply-To: myplace2@example.com\r\n";
$headers .= "Return-Path: myplace@example.com\r\n";
$headers .= "CC: sombodyelse@example.com\r\n";
$headers .= "BCC: hidden@example.com\r\n";
mail($to_email,$subject,$message,$headers);
any help please
It seems like your SMTP server is not configured well.
To be aware of spam emails, the latest mail clients will check who is sending an email. It uses a test like Reverse-DNS-Lookups.
Your PHP mail() function will fail with this test.
Solution: You can use PHPMailer-Class and configure it to use SMTP-auth along with a well configured, dedicated SMTP Server (Recommended AWS server) and your problems will be fixed 100%.
Eslam Zedan
28 Feb 2022
My clint does not want me to use SMTP so I am using native php mail function
© 2024 Copyrights reserved for web-brackets.com