sungpeng Posted July 3, 2010 Share Posted July 3, 2010 $to = 'sun@hotmail.com'; $headers = 'From:sun@hotmail.com' . "\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? Quote Link to comment 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 sun@hotmail.com, 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 = '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); ?> Another option is to use something like the PHP Mailer class which I have found extremely useful. http://phpmailer.worxware.com/ Quote Link to comment Share on other sites More sharing options...
sungpeng Posted July 3, 2010 Author Share Posted July 3, 2010 'Reply-To: sun@hotmail.com' . "\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: server@hostingserver.com Sent: 03 July 2010 20: 13PM To: sungpeng@hotmail.com The "FROM" is not "sun@hotmail.com" instead it is "server@hostingserver.com".. can I know is there any solution to it? Quote Link to comment 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 whatever@sungpeng.com Is sun@hotmail.com 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. 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.