Published in : 2022-02-28
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?
but it goes to junk
here is my code
$to_email = 'email@example.com'; $subject = 'Testing PHP Mail'; $message = 'This mail is sent using the PHP mail function'; $headers = "From: firstname.lastname@example.org\r\n"; $headers .= "Reply-To: email@example.com\r\n"; $headers .= "Return-Path: firstname.lastname@example.org\r\n"; $headers .= "CC: email@example.com\r\n"; $headers .= "BCC: firstname.lastname@example.org\r\n"; mail($to_email,$subject,$message,$headers);
any help please
Shilpa Date : 2022-02-28
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 Date : 2022-02-28
My clint does not want me to use SMTP so I am using native php mail function
Join our community and get the chance to solve your code issues & share your opinion with usSign up Now