28 Feb 2022
PHP & Mysql
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 = 'firstname.lastname@example.org'; $subject = 'Testing PHP Mail'; $message = 'This mail is sent using the PHP mail function'; $headers = "From: email@example.com\r\n"; $headers .= "Reply-To: firstname.lastname@example.org\r\n"; $headers .= "Return-Path: email@example.com\r\n"; $headers .= "CC: firstname.lastname@example.org\r\n"; $headers .= "BCC: email@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%.
28 Feb 2022
My clint does not want me to use SMTP so I am using native php mail function
© 2023 Copyrights reserved for web-brackets.com