Hello, I'm hosting my site on Domain.com (the Deluxe plan). I'm having a problem with sending emails with this code : <?php require_once "Mail.php"; $msg = $_GET['msg']; $username = $_GET['paypal']; $name = $_GET['name']; $to = 'themilliardaire@msn.com'; $subject = 'Site Contact Form'; $message = $name. ' wants to contact you. He send the following message : ' . $msg . ' His username is : ' . $username; $header .= "Reply-To: Site <info@Site.com>\r\n"; $header .= "Return-Path: Site<info@Site.com>\r\n"; $header .= "From: Site<info@Site.com>\r\n"; $header .= "Organization: Site\r\n"; $header .= "Content-Type: text/plain\r\n"; $res = mail($to, $subject, $message, $header); if($res) { echo "OK"; } else { echo "BAD"; } ?> Code (markup): I either get a "BAD" or nothing at all which is really weird. Any help?
There's nothing wrong with that code. Everything works perfectly. I suggest that you check inside Mail.php or those $_GET or if you're even allowed to use PHP mail in your webhost.
Check your host hasn't disabled the mail() function (which believe it or not some hosts do - namely free as a measure to prevent spam) either via php.ini (disabled_functions) or using php -> function_exists() Furthermore add error_reporting(E_ALL); at the top of your code, to see if theirs any underlying errors. Let me know how that goes, also include any errors in your next reply if apparent. PS: On a side note you may want to validate and/or clean your inputs (strip potential headers)
Hi Grunt, Ur Sending mail coding r perfect, some problem in ur domain So u check Ur mail file in your web host Virginmind Technologies