Jump to content

mail() format being rejected by linux server


jonsamwell

Recommended Posts

The below code works fine to windows mail server but is being rejected by linux servers because of the mail format (so tech support says)

 

The error returned is that the remote server (mail.zippymail.co.uk) drops the connection because the server does not accept the mail in the format i am sending it in.

 

I don't really have a clue what this means or how to change the format of the email. Tech support have just fobbed me off really.

 

Please help

 

Thanks

 

Jon

 

function newCompanyMail($clientName, $username, $password, $recipient, $companyKey, $moduleCost)
{//sends a email to the company admin user containing company details
    $senderemail = '[email protected]';
    $sendername = 'Company Name\r\n';
    $mailheader = "From: $senderemail\r\n";
    $mailheader .= "Reply-To: No-Reply\r\n";
    $moduleCost = number_format($moduleCost, 2);

    //email variables
    $subject = 'blah blah :: blah blah:: blah blah - blah blah\r\n';

    //Message
    $message = "blah blah.\r\n\r\n";
    $message .= "blah blah ";
    $message .= "blah blah.\r\n\r\n";
    $message .= "You can login to your account at http://www.mydomain.co.uk/blah/\r\n\r\n";
    $message .= "blah blah.\r\n\r\n";
    $message .= "Your Compnay Account Details:\r\n\r\n";
    $message .= "   Company Name:   $clientName\r\n";
    $message .= "   Admin Username: $username\r\n";
    $message .= "   Admin Password: $password\r\n";
    $message .= "   Company Key:    $companyKey\r\n";
    $message .= "   Module Cost:    £$moduleCost\r\n\r\n";
    $message .= "NOTE: blah blah.\r\n\r\n";
    $message .= "For technical support please email [email protected].\r\n\r\n";
    $message .= "Best regards,\r\n\r\n\r\n";
    $message .= "Company Name\r\n";

    ini_set('sendmail_from', $senderemail);

    mail($recipient, $subject, $message, $mailheader) or die ("Failure");
}

on a linux server you want to use \n instead of \r\n for your email headers.

 

You also want to comment out     ini_set('sendmail_from', $senderemail); because it does not get used on linux.

 

 

 

Thanks for you help, this is still not working, but works to every other email i have tried bar my web host internal mail servers??

 

Does anyone think this is less of a problem with the code and some internal error my host has??

 

Jon

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.