PHP mail function error

Proximity

IDK?
Feb 13, 2014
673
56
I have a php mail server on my VPS and it doesn't send the emails to personal emails like @mydomain.com

Here the script

Code:
<?php 
    ini_set( 'display_errors', 1 );
    error_reporting( E_ALL );
    $from = "[email protected]";
    $to = "[email protected]";
    $subject = "PHP Mail Test script";
    $message = "Sends to gmail but not personal servers";
    $headers = "From:" . $from;
    mail($to,$subject,$message, $headers);
    echo "Test email sent";
?>
 

bittern

New Member
Nov 5, 2014
8
2
Post any errors that PHP gives you. It's also possible that your server/IP-range has been blacklisted by whoever you're trying to send email to.

Try confirming that the email was sent using a simple if/else statement.
PHP:
<?php
    $from = "[email protected]";
    $to = "[email protected]";
    $subject = "PHP Mail Test script";
    $message = "Sends to gmail but not personal servers";
    $headers = "From:" . $from;

    if(@mail($to,$subject,$message, $headers)){
        echo "Test email sent.";
    }else{
        echo "Test email not sent.";
    }
?>
 
Last edited:

Users who are viewing this thread

Top