Hi, I've got a simple email script which does successfully send an email to the recipient, however the email always ends up in their SPAM folder. The code is as follows: <?php $to = $_POST[remail]; $subject = "Thank you for registering"; $message = " <html> <head> <title>Thank you for registering</title> </head> <body> <p>To activate your account please click the link below.</p> LINK </body> </html> "; $headers = "MIME-Version: 1.0" . "\r\n"; $headers .= "Content-type:text/html; charset=iso 8859-1" . "\r\n"; $headers .= 'From: <donotreply@*************>' . "\r\n"; mail($to,$subject,$message,$headers); ?> PHP: Any help with this would be greatly appreciated. Thanks.
Try using "from" and "reply-to" addresses which come from same domain of where your mail() script resides. So unless you're the owner of Google, it can't be Perhaps?
Also, make sure your server is set up with proper records to allow for email-sending. You can read up here, for a quite in-depth explanation why you might not want to run your own mail-server, and how to do it if you still do want to do that.
Sending directly via MTA is considered a huge faux pas nowadays, try setup a proper SMTP server with DKIM / SPF
PHP mail function defaults to the shared IP of your server (for most hosts) and does not add necessary headers such as DKIM. The best way to improve a delivery is to setup the email/SMTP account (with your cpanel/plesk, etc panel and/or third party smtp provider). Set up proper SPF/DKIM DNS records for that domain in question. I suggest to use phpmailer or swiftmailer libraries for SMTP authenticated emails. Keep in mind that, in-boxing the email is mainly dependent on IP address reputation, IP usage history, domain reputation, your email content and so on.
hi , please can you check your server ip if its backlisted or not ! -please try to use the from email a real working email try to use this header and change what neseccary $header = "MIME-Version: 1.0\n"; $header .= "Content-type: text/html; charset=iso-8859-1\n"; $header .= "From: "*****@*****.*** " <" . $de . ">\n"; $header .= "Reply-To: " *****@*****.*** "\n"; $header .= "X-Priority: 3\n"; $header .= "X-MSMail-Priority: Normal\n"; $header .= "X-Mailer: ".$_SERVER["HTTP_HOST"];