Mail gets into spam, how do I change it?

Added the usual function of sending a message:

<?php
$to = "[email protected]"; 

$subject = "Test mail"; 

$message = "Hello! This is a simple email message."; 

$from = "[email protected]"; 

$headers = "From: Info <[email protected]>\r\n"; 

mail($to,$subject,$message,$headers); 

echo "Mail Sent."; 

I decided to check for spam via mail-tester. It shows 0/10(even -2). The most basic error is: Return address : [email protected]. Although I installed FROM. The error is definitely not in the email sending code. And also writes [SPF] example.com does not allow your myserverIP server to use [email protected] I see the same errors if I send a message to any mail server. For example on mail.ru. Then I go to the email details and see the discrepancies again. It's like I'm sending mail on behalf of another domain. Although I registered an email address.

How else can I confirm that my server, domain, and mail are one?

Centos is installed on vds. It costs ISPmanager. I configured all the necessary txt, CNAME, mx records with yandex on the domain Added via pdd.yandex.ru domain and confirmed it. I created an email there. Added all necessary spf, DKIM signatures

SOLUTION Necessary set the option sendmail_path = /usr/sbin/sendmail -t-i-f [email protected] in php. ini

Author: Pavel, 2018-07-29

2 answers

ISPmanager uses for PHP the E-Mail that is registered for the site in its settings as the address of the webmaster. This is done by setting the PHP sendmail_path parameter in the Apache configuration files, adding a string like php_admin_value sendmail_path "/usr/sbin/sendmail -t -i -f [email protected]" to the <IfModule php5_module> section. You can try changing the address in the panel to your real address. This parameter belongs to PHP_INI_SYSTEM, so you can only change it in the system php. ini or in the Apache configuration file. Also, don't forget about SPF, DKIM, and DMARC entries in DNS.

 1
Author: evs, 2018-07-30 01:05:39

First of all, you need to use PhpMailer And secondly, you should use the projected SMTP Servers, like Gmail.

 -1
Author: Евгений Иванов, 2018-07-29 02:03:29