jonsamwell Posted January 30, 2009 Share Posted January 30, 2009 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 = 'blah@mydomain.co.uk'; $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 xyz@mydomain.com.\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"); } Quote Link to comment Share on other sites More sharing options...
phparray Posted January 30, 2009 Share Posted January 30, 2009 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. Quote Link to comment Share on other sites More sharing options...
jonsamwell Posted January 31, 2009 Author Share Posted January 31, 2009 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 Quote Link to comment Share on other sites More sharing options...
DarkSuperHero Posted January 31, 2009 Share Posted January 31, 2009 maybe the mail server doesn't like the no-reply part ? spam prevention maybe ? Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.