Jump to content

Form mail help!


isi

Recommended Posts

Hi there, new to the forum  ;D

 

I just set up a godaddy hosting account with PHP5 and migrated my site from Site5, i had this php form working but not it just doesnt send out the email - could this be because of the PHP version?

 

<?php
$to = "[email protected]";
$subject = "Email";

$body .= "Name: " . $HTTP_POST_VARS['sender_name'] . "\n";
$body .= "Contact Number: " . $HTTP_POST_VARS['sender_cnum'] . "\n";
$body .= "Address: " . $HTTP_POST_VARS['sender_addy'] . "\n";
$body .= "Post Code: " . $HTTP_POST_VARS['sender_postcode'] . "\n";
$body .= "Reply Email Address: " . $HTTP_POST_VARS['sender_email'] . "\n\n";

$body .= "Event Type: " . $HTTP_POST_VARS['event_type'] . "\n";
$body .= "Venue Address: " . $HTTP_POST_VARS['venue_addy'] . "\n";
$body .= "Venue Post Code: " . $HTTP_POST_VARS['venue_postcode'] . "\n";
$body .= "Event Start Time: " . $HTTP_POST_VARS['event_starttime'] . "\n";
$body .= "Venue Contact Number: " . $HTTP_POST_VARS['venue_cnum'] . "\n\n";

$body .= "Other Requirements: " . $HTTP_POST_VARS['other_requirements'] . "\n";
$body .= "\n\n---------------------------\n";
$body .= "Mail sent by: " . $HTTP_POST_VARS['sender_name'] . " <" . $HTTP_POST_VARS['sender_email']  . ">\n";

$header = "From: " . $HTTP_POST_VARS['sender_name'] . " <" . $HTTP_POST_VARS['sender_email'] . ">\n";
$header .= "Reply-To: " . $HTTP_POST_VARS['sender_name'] . " <" . $HTTP_POST_VARS['sender_email'] . ">\n";
$header .= "X-Mailer: PHP/" . phpversion() . "\n";
$header .= "X-Priority: 1";


if(@mail($to, $subject, $body, $header))
{
	echo "output=sent";
} else {
	echo "output=error";
}
?>

 

Is there something broken in the code? when I execute it is does print "output=sent".

 

Thanks,

isi

Link to comment
https://forums.phpfreaks.com/topic/136774-form-mail-help/
Share on other sites

Try

 

<?php
$to = "[email protected]";
$subject = "Email";

$body .= "Name: " . $_POST['sender_name'] . "\n";
$body .= "Contact Number: " . $_POST['sender_cnum'] . "\n";
$body .= "Address: " . $_POST['sender_addy'] . "\n";
$body .= "Post Code: " . $_POST['sender_postcode'] . "\n";
$body .= "Reply Email Address: " . $_POST['sender_email'] . "\n\n";

$body .= "Event Type: " . $_POST['event_type'] . "\n";
$body .= "Venue Address: " . $_POST['venue_addy'] . "\n";
$body .= "Venue Post Code: " . $_POST['venue_postcode'] . "\n";
$body .= "Event Start Time: " . $_POST['event_starttime'] . "\n";
$body .= "Venue Contact Number: " . $_POST['venue_cnum'] . "\n\n";

$body .= "Other Requirements: " . $_POST['other_requirements'] . "\n";
$body .= "\n\n---------------------------\n";
$body .= "Mail sent by: " . $_POST['sender_name'] . " <" . $_POST['sender_email']  . ">\n";

$header = "From: " . $_POST['sender_name'] . " <" . $_POST['sender_email'] . ">\n";
$header .= "Reply-To: " . $_POST['sender_name'] . " <" . $_POST['sender_email'] . ">\n";
$header .= "X-Mailer: PHP/" . phpversion() . "\n";
$header .= "X-Priority: 1";


if(@mail($to, $subject, $body, $header))
{
	echo "output=sent";
} else {
	echo "output=error";
}
?>

Link to comment
https://forums.phpfreaks.com/topic/136774-form-mail-help/#findComment-714327
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.