We are using php mail function to send emails to our customers. Few days ago, we've found that email are not delivered to only hotmail.com domain. I've checked email log to see if there are any error messages, and here is what I've found:

Aug 30 23:02:50 XXX sendmail[35378]: AXXX: to=<[email protected]>, ctladdr=<apache@XXX> (48/48), delay=00:00:05, xdelay=00:00:05, mailer=esmtp, pri=121148, relay=mx.XXX. [], dsn=5.6.0, stat=Data format error

Aug 30 23:02:50  sendmail[35378]: DSN: Data format error

What is this Data format error and how it can be fixed? What is this ctladdr and do I need to set it using PHP or not? Do I need to contact my server provider about this issue, or this is my php application related issue?

My PHP code for sending the emails is:

       function send_email( $name_from, $email_from, $email_to, $subject, $message, $headers="" ) {

    $returnVal = 0;

    // made it through validation, send email
    $subject = trim( $subject );
    $message = trim( $message );
    $headers .= "FROM: $name_from <$email_from>";

    if( mail( "$email_to", "$subject", "$message", "$headers") or die ( trigger_error ( "Error: ", E_USER_ERROR ))) {
        $returnVal = 1;
    return $returnVal;

As you can see in my $headers I set the FROM field.

Thx for answers?

1 Answer 1


The domain name of your server is not being accepted (used in the FROM). It either is not resolvable, has incorrect format, etc.

  • The domain name of your server is not being accepted - Accepted by who? Please can you elaborate a bit?
    – Mr.M
    Sep 2, 2014 at 11:46
  • It looks like the local sendmail is not accepting it. The weird part is that you mention it only fails for hotmail.com. It should fail for everybody. In any case, having a proper From field ([email protected], resolvable) is the best practice. You probably should fix it in the PHP script if you don't have control over the sendmail configuration (to apply a default domain, for instance).
    – anon
    Sep 2, 2014 at 11:52
  • I update my question, and added PHP code I use for sending the emails. As you can see i set the FROM field!
    – Mr.M
    Sep 2, 2014 at 12:00
  • Where is the value of $email_from coming from? What is it when the operation fails?
    – anon
    Sep 2, 2014 at 12:01
  • The $email_from is passed as function argument. The value is [email protected].
    – Mr.M
    Sep 2, 2014 at 12:05

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .