sungpeng Posted July 3, 2010 Share Posted July 3, 2010 $to = '[email protected]'; $headers = 'From:[email protected]' . "\r\n"; mail($to, $subject, $message, $headers); From the above code, it is going to the junk mail.. is it possible for it to go to the inbox mail? Link to comment https://forums.phpfreaks.com/topic/206609-inbox-mail-rather-than-junk-mail/ Share on other sites More sharing options...
joel24 Posted July 3, 2010 Share Posted July 3, 2010 two options have a play around, try changing the "from" email to a legitimate email and putting a space between From: and [email protected], also you don't need \r\n in the header unless you do another line, i.e. reply-to The example given at http://php.net/manual/en/function.mail.php is <?php $to = '[email protected]'; $subject = 'the subject'; $message = 'hello'; $headers = 'From: [email protected]' . "\r\n" . 'Reply-To: [email protected]' . "\r\n" . 'X-Mailer: PHP/' . phpversion(); mail($to, $subject, $message, $headers); ?> Another option is to use something like the PHP Mailer class which I have found extremely useful. http://phpmailer.worxware.com/ Link to comment https://forums.phpfreaks.com/topic/206609-inbox-mail-rather-than-junk-mail/#findComment-1080596 Share on other sites More sharing options...
sungpeng Posted July 3, 2010 Author Share Posted July 3, 2010 'Reply-To: [email protected]' . "\r\n" . 'X-Mailer: PHP/' . phpversion(); mail($to, $subject, $message, $headers); The above code sent a message to inbox not junk mail.. but the result is as follow.. From: [email protected] Sent: 03 July 2010 20: 13PM To: [email protected] The "FROM" is not "[email protected]" instead it is "[email protected]".. can I know is there any solution to it? Link to comment https://forums.phpfreaks.com/topic/206609-inbox-mail-rather-than-junk-mail/#findComment-1080662 Share on other sites More sharing options...
joel24 Posted July 3, 2010 Share Posted July 3, 2010 change the hostingserver.com domain to your server the script is being run on. i.e. if you're domain is www.sungpeng.com, change it to [email protected] Is [email protected] your actual email? Obviously your spam filter is picking it up as spam, probably because its allegedly a email from a hotmail account coming from another domain, although I'm not 100% sure on what triggers said spam filters. Link to comment https://forums.phpfreaks.com/topic/206609-inbox-mail-rather-than-junk-mail/#findComment-1080878 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.