I've got this script for a contact form that was working well on the old server. We needed to move on a new server and now it only works if I send emails to Gmail or Live address. If I try to send emails to my own email assistenzatecnica@actainfo.it, it doesn't work.
$from = trim($_POST['email']);
$message = trim($_POST['message']);
$username = trim($_POST['username']);
/*Invia mail*/
$body = '<html><body>';
$body .= '<p><strong>Da:</strong> '.$username.' - '.$from.'</p>';
$body .= '<p>'.$message.'</p>';
$body .= '</body></html>';
$headers = 'From: '.$from.'' . "\r\n";
$headers .= 'MIME-Version: 1.0' . "\r\n" .
'Content-type: text/html; charset=utf-8' . "\r\n" .
'X-Mailer: PHP/' . phpversion();
mail("assistenzatecnica@actainfo.it", "ActaPrivacy - Richiesta Assistenza", $body, $headers);
The php.ini file is exactly the same as the one from the old server. Server is linux and I left the default values
[mail function]
; For Win32 only.
SMTP = localhost
smtp_port = 25
; For Win32 only.
;sendmail_from = me@example.com
; For Unix only. You may supply arguments as well (default: "sendmail -t -i").
sendmail_path = /usr/sbin/sendmail -t -i
I don't know what else I can do, what's weird is that it works if I send to Gmail, so why it doesn't work when I send to my own mail?
I can already move to PHPMailer, but I would also like to understand why this is not working properly if it was working before and the settings are the same.