Board index   FAQ   Search  
Register  Login
Board index php forum :: php coding PHP coding => Mail

Contact form not sending to gmail adresses

the mail() function

Moderators: macek, egami, gesf

Contact form not sending to gmail adresses

Postby linzee » Tue Apr 02, 2013 9:43 pm

I have a contact form that isn't sending emails to gmail addresses.
( In this bit below: $to = ''; )
When I put Non-gmail addresses in, they get through!
Can anyone help with that?

This is the code i have:

$name = $_POST['name'];
$day = $_POST['day'];
$phone = $_POST['phone'];
$email = $_POST['email'];
$age = $_POST['age'];
$message = $_POST['message'];
$from = 'From: bookings page';
$to = '';
$subject = $_POST['name'];
$human = $_POST['human'];
$body = "From: $name\n Phone: $phone\n E-Mail: $email\n What State and Country are in: $state\n Message:\n $message";
if ($_POST['submit']) {
if ($name != '' && $email != '') {
if ($human == '4') {
if (mail ($to, $subject, $body, $from)) {
echo '.... here i have HTML code that personalizes the thankyou page....

New php-forum User
New php-forum User
Posts: 1
Joined: Tue Apr 02, 2013 9:26 pm

Re: Contact form not sending to gmail adresses

Postby johnj » Thu Apr 04, 2013 1:30 am

In your php.ini, are you setting the correct smtp server name, port etc when you try to use gmail?
php-forum Super User
php-forum Super User
Posts: 1805
Joined: Thu Mar 10, 2011 5:07 pm

Return to PHP coding => Mail

Who is online

Users browsing this forum: No registered users and 1 guest

Sponsored by Sitebuilder Web hosting and Traduzioni Italiano Rumeno and antispam for cPanel.