Mail() & Gmail help!!

Hi
Im trying to set up a really super simple email contact form, but every time I send a test email it comes up with Warning: mail(): Failed to connect to mailserver at “localhost” port 25, verify your “SMTP” and “smtp_port” setting in php.ini or use ini_set() in …. The email it’s meant to be sending to is a gmail account. The instructions I had to build the form originally were really simple and never mentioned anything to do with a php.ini or ini_set() so maybe its just the lack of those that’s causing the problem???

My code so far is:
[php]<?php ini_set("error_reporting",E_ALL &~E_NOTICE); ?>

Sendemail <?php $visitor = $_POST['visitor']; $visitoremail = $_POST['visitoremail']; $notes = $_POST['notes']; $attn = $_POST['attn']; $notes = $_POST['notes']; $phone = $_POST['phone']; $attn = $attn ; $subject = $attn; $message = " Attention: $attn
Contact Number: $phone
Message: $notes
From: $visitor ($visitoremail)"; $from = "From: $visitoremail"; mail($mail, $subject, $message, $from); $mail="[email protected]"; ?>

Thank You : <?php echo $visitor ?> ( <?php echo $visitoremail ?> )
Contact Number: <?php echo $phone ?>

Attention: <?php echo $attn ?>

Message:
<?php echo $notes ?>




Next Page

[/php]

Any help would really be appreciated

One quick issue is your email variable needs to be defined before the email script. I don’t think this will solve your problem though. To solve your problem i’d contact your host and make sure your host allows you to send email via email().

[php]
mail($mail, $subject, $message, $from);
$mail="[email protected]";
[/php]

should be…

[php]
$mail="[email protected]";
mail($mail, $subject, $message, $from);
[/php]

also I think

[php]$attn = $attn ;[/php]

Is redundant, you can remove this line.

yes this is the problem. i need to find php.ini file in your system and find variable smtp_port ahead of this there is ‘#’ sign remove this and restart your server.and also check your system that you have installed SMTP server in your server.

Sponsor our Newsletter | Privacy Policy | Terms of Service