rfmeier Posted June 18, 2007 Share Posted June 18, 2007 Hello, I am relatively new to PHP. I am in the process of creating my own website and want to add a contact/comment page. I am using Win XP+Apache. I usually use gMail for all my mail and was wondering if it is possible to send email through my gMail account using PHP. Will the mail() PHP function work for this? I have tried looking for a tutorial online, but haven't found one yet. Is there anyone who could point me in the direction about how I can begin with this? Thanks in advance. RFMeier Quote Link to comment https://forums.phpfreaks.com/topic/56060-php-e-mail-help/ Share on other sites More sharing options...
per1os Posted June 18, 2007 Share Posted June 18, 2007 http://www.vulgarisoip.com/?p=17 I believe that is what you need. Quote Link to comment https://forums.phpfreaks.com/topic/56060-php-e-mail-help/#findComment-276863 Share on other sites More sharing options...
atomicrabbit Posted June 18, 2007 Share Posted June 18, 2007 ... to send email through my gMail account using PHP ... WHat do you mean by this? Do you mean you want the email that gets sent from the php email form to be FROM your gmail account? If so, all you have to do is set the email headers so that the from email address is your gmail address. You can do it like this: $from_name = "John Smith"; $from_email = "your_email_goes_here@gmal.com"; $to_email = "to@email.com"; $subject = "This is the email subject"; $message = "This is my message text\n You can write as much as you would like here"; $headers = "From: $from_name<$from_email>\n"; $headers .= "Reply-To: <$from_email>\n"; mail($to_email, $subject, $message, $headers); Quote Link to comment https://forums.phpfreaks.com/topic/56060-php-e-mail-help/#findComment-276868 Share on other sites More sharing options...
rfmeier Posted June 18, 2007 Author Share Posted June 18, 2007 Thanks for the replies. I will try these out. Does the mail() function have to use an email account of sort in order to send the mail to someone? Quote Link to comment https://forums.phpfreaks.com/topic/56060-php-e-mail-help/#findComment-276906 Share on other sites More sharing options...
GingerRobot Posted June 18, 2007 Share Posted June 18, 2007 In theory, no. But it will depend on your host. Some free hosts put some restriction on the use of the mail() function to prevent spam - i've seen some which only allow you to use it if you're paying to use their email too etc. Some hosts dont support the function at all. Quote Link to comment https://forums.phpfreaks.com/topic/56060-php-e-mail-help/#findComment-276935 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.