kevin7 Posted July 21, 2007 Share Posted July 21, 2007 <? $to = 'xxx@gmail.com'; $subject = 'Testing of email'; $message = '<b>yo</b>, whassup?'; $headers = "From: someone@gmail.com\r\n" . 'X-Mailer: PHP/' . phpversion() . "\r\n" . "MIME-Version: 1.0\r\n" . "Content-Type: text/html; charset=utf-8\r\n" . "Content-Transfer-Encoding: 8bit\r\n\r\n"; // Send if (mail($to, $subject, $message, $headers)) { echo "Mail Sent"; } else { echo "Mail Failed"; } ?> I'm creating a script that will allow client to send mail to another client using a form with php mail() function... I have uploaded this script to the server, and i'm able to send a mail back to the server email address, and then, i tried to send mail to my gmail account, i received nothing, i tried and tried, and use the code provided in php.net/mail still no clue... i hv totally ran out of ideas and im here to seek for help... can anyone tell me what's wrong with my code, or perhaps... can you show me the code that will able to send to other mail services such as yahoo, gmail, hotmail and so on... and, i hv looked at the spam section of gmail, nothing was found.. thanks! Quote Link to comment Share on other sites More sharing options...
Fadion Posted July 24, 2007 Share Posted July 24, 2007 From what i can see, the script looks ok. If it send email internally then it has to do with the mail server configuration. Maybe the external gateway requires SMPT Authentication to relay your mail, so it may need username and password. Or just check if gmail or any other free email account is blocked by the mail server. Anyway i think it has nothing to do with your php script. 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.