chant9 Posted October 31, 2007 Share Posted October 31, 2007 Im using the mail() function in PHP but when emails are sent to Hotmail accounts they are being classified as Junk. I've checked the headers of the emails it is says they are being received from apache@localhost as shown below. Received: (from apache@localhost) I think this could be why they are considered junk, does anyone know how to configure sendmail for it to be recieved from something like webmaster@mydomain.co.uk? I've tried various PHP things but nothing has helped so I'm assuming its something to do with the server configuration. Many Thanks Quote Link to comment https://forums.phpfreaks.com/topic/75507-php-with-sendmail-from-apachelocalhost/ Share on other sites More sharing options...
trq Posted October 31, 2007 Share Posted October 31, 2007 At the very least you'll want to add a From header to your call to the mail function. <?php mail('foo@foo.com','test','hello','From: you@yourdomain.com\n'); ?> Quote Link to comment https://forums.phpfreaks.com/topic/75507-php-with-sendmail-from-apachelocalhost/#findComment-381935 Share on other sites More sharing options...
chant9 Posted October 31, 2007 Author Share Posted October 31, 2007 Yeah I tried this but it doesnt change anything it still says Received: (from apache@localhost) and goes into Junk. Quote Link to comment https://forums.phpfreaks.com/topic/75507-php-with-sendmail-from-apachelocalhost/#findComment-381974 Share on other sites More sharing options...
rajivgonsalves Posted October 31, 2007 Share Posted October 31, 2007 Going in junk is not part of any headers you put, it depends on your host ip etc. if you send mail too fast through a script they envelope and go at one time, the spam agents pick them up easily.. used to face this problem 4 years ago when I was into mailing stuff anyways if I am wrong take look at this <?php $to = 'nobody@example.com'; $subject = 'the subject'; $message = 'hello'; $headers = 'From: webmaster@example.com' . "\r\n" . 'Reply-To: webmaster@example.com' . "\r\n" . 'X-Mailer: PHP/' . phpversion(); mail($to, $subject, $message, $headers); ?> got it from http://php.net/manual/en/function.mail.php Quote Link to comment https://forums.phpfreaks.com/topic/75507-php-with-sendmail-from-apachelocalhost/#findComment-381978 Share on other sites More sharing options...
chant9 Posted October 31, 2007 Author Share Posted October 31, 2007 Thanks Rajiv, I've tried this but it still went into the Junk. Im not trying to send lots of emails only one from a webform. I tried loads of different php mail() techniques now but they always go into Junk, which is why i think rather than the php code I think it could be the way the server/sendmail is configured with it always saying from apache@localhost. Thanks anyway Quote Link to comment https://forums.phpfreaks.com/topic/75507-php-with-sendmail-from-apachelocalhost/#findComment-381998 Share on other sites More sharing options...
steviewdr Posted November 2, 2007 Share Posted November 2, 2007 Here you go: http://wiki.kartbuilding.net/index.php/Sendmail I had the exact same problems as you. I made my own sendmail config and used it via php. -steve Quote Link to comment https://forums.phpfreaks.com/topic/75507-php-with-sendmail-from-apachelocalhost/#findComment-383179 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.