Jump to content

[SOLVED] Form to Email...


Hunter94

Recommended Posts

Alright, well here it is. I can't find any thing wrong with it. And here is my email I'm using. hunter@superiorgfx.site11.com

 

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Email Form </title>
</head>
<body>

<form method="post" action="sendeail.php">

<!-- DO NOT change ANY of the php sections -->
<?php
$ipi = getenv("REMOTE_ADDR");
$httprefi = getenv ("HTTP_REFERER");
$httpagenti = getenv ("HTTP_USER_AGENT");
?>

<input type="hidden" name="ip" value="<?php echo $ipi ?>" />
<input type="hidden" name="httpref" value="<?php echo $httprefi ?>" />
<input type="hidden" name="httpagent" value="<?php echo $httpagenti ?>" />


Your Name: <br />
<input type="text" name="visitor" size="35" />
<br />
Your Email:<br />
<input type="text" name="visitormail" size="35" />
<br /> <br />
<br />
Attention:<br />
<select name="attn" size="1">
<option value=" Sales n Billing ">Sales n Billing </option>
<option value=" General Support ">General Support </option>
<option value=" Technical Support ">Technical Support </option>
<option value=" Webmaster ">Webmaster </option>
</select>
<br /><br />
Mail Message:
<br />
<textarea name="notes" rows="4" cols="40"></textarea>
<br />
<input type="submit" value="Send Mail" />
<br />
</form>

</body>
</html>

 

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Sendemail Script</title>
</head>
<body>

<!-- Reminder: Add the link for the 'next page' (at the bottom) -->
<!-- Reminder: Change 'YourEmail' to Your real email -->

<?php

$ip = $_POST['ip'];
$httpref = $_POST['httpref'];
$httpagent = $_POST['httpagent'];
$visitor = $_POST['visitor'];
$visitormail = $_POST['visitormail'];
$notes = $_POST['notes'];
$attn = $_POST['attn'];


if (eregi('http:', $notes)) {
die ("Do NOT try that! ! ");
}
if(!$visitormail == "" && (!strstr($visitormail,"@") || !strstr($visitormail,".")))
{
echo "<h2>Use Back - Enter valid e-mail</h2>\n";
$badinput = "<h2>Feedback was NOT submitted</h2>\n";
echo $badinput;
die ("Go back! ! ");
}

if(empty($visitor) || empty($visitormail) || empty($notes )) {
echo "<h2>Use Back - fill in all fields</h2>\n";
die ("Use back! ! ");
}

$todayis = date("l, F j, Y, g:i a") ;

$attn = $attn ;
$subject = $attn;

$notes = stripcslashes($notes);

$message = " $todayis [EST] \n
Attention: $attn \n
Message: $notes \n
From: $visitor ($visitormail)\n
Additional Info : IP = $ip \n
Browser Info: $httpagent \n
Referral : $httpref \n
";

$from = "From: $visitormail\r\n";


mail("hunter@superiorgfx.site11.com", $subject, $message, $from);

?>

<p align="center">
Date: <?php echo $todayis ?>
<br />
Thank You : <?php echo $visitor ?> ( <?php echo $visitormail ?> )
<br />

Attention: <?php echo $attn ?>
<br />
Message:<br />
<?php $notesout = str_replace("\r", "<br/>", $notes);
echo $notesout; ?>
<br />
<?php echo $ip ?>

<br /><br />
<a href="contact.php"> Next Page </a>
</p>

</body>
</html>

Link to comment
https://forums.phpfreaks.com/topic/180720-solved-form-to-email/#findComment-953468
Share on other sites

  Quote

And the problem is ?

 

As a guess its not sending.. okay any more info ?

 

have you setup the SMTP server in the php.ini ?

Yea, it wont send and I'm using 000webhost its all setup already. =/

 

This is the message I get after I send the test message.

 

Date: Saturday, November 7, 2009, 11:22 pm
Thank You : Hunter ( jack@hotmail.com )
Attention: Sales n Billing
Message:
Noob face test
98.

Link to comment
https://forums.phpfreaks.com/topic/180720-solved-form-to-email/#findComment-953473
Share on other sites

change

mail("hunter@superiorgfx.site11.com", $subject, $message, $from);

to

if(mail("hunter@superiorgfx.site11.com", $subject, $message, $from))
{
echo "Sent";
}else{
echo "Failed to send";
}

 

if you get the 'Failed to send' check your SMTP server

Link to comment
https://forums.phpfreaks.com/topic/180720-solved-form-to-email/#findComment-953502
Share on other sites

Ok, I got every thing working and I was adding new sections of the form and I got done and I get this error each time I try and send it.

 

Parse error: syntax error, unexpected T_STRING in /home/a4202716/public_html/sendeail.php on line 62

 

here is sendeail.php if you guys can fix it for me that would be great. Lol I suck with php. =)

 

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Sendemail Script</title>
</head>
<body>

<!-- Reminder: Add the link for the 'next page' (at the bottom) -->
<!-- Reminder: Change 'YourEmail' to Your real email -->

<?php

$ip = $_POST['ip'];
$httpref = $_POST['httpref'];
$httpagent = $_POST['httpagent'];
$visitor = $_POST['visitor'];
$visitormail = $_POST['visitormail'];
$name = $_POST['name'];
$notes = $_POST['notes'];
$attn = $_POST['attn'];
$image = $_POST['image'];
$size = $_POST['size'];
$font = $_POST['font'];



if (eregi('http:', $notes)) {
die ("Do NOT try that! ! ");
}
if(!$visitormail == "" && (!strstr($visitormail,"@") || !strstr($visitormail,".")))
{
echo "<h2>Use Back - Enter valid e-mail</h2>\n";
$badinput = "<h2>Feedback was NOT submitted</h2>\n";
echo $badinput;
die ("Go back! ! ");
}

if(empty($visitor) || empty($visitormail) || empty($notes )) {
echo "<h2>Use Back - fill in all fields</h2>\n";
die ("Use back! ! ");
}

$todayis = date("l, F j, Y, g:i a") ;

$attn = $attn ;
$subject = $attn;

$notes = stripcslashes($notes);

$message = " $todayis [EST] \n
Attention: $attn \n
Message: $notes \n
From: $visitor ($visitormail)\n
Additional Info : IP = $ip \n
Browser Info: $httpagent \n
Referral : $httpref \n
Name on the Graphic : $name \n
Image on the Graphic  : $image \n
Size of Graphic (Leave this blank if you want me to pick a size out for you.) : $size \n
Font (Leave this blank if you want me to pick one out. If you want to pick one out get it from. <a href="http://www.dafont.com/">Dafont</a>) : $font \n
";

$from = "From: $visitormail\r\n";


mail("hunter@superiorgfx.site11.com", $subject, $message, $from);

?>

<p align="center">
Date: <?php echo $todayis ?>
<br />
Thank You : <?php echo $visitor ?> ( <?php echo $visitormail ?> )
<br />

Attention: <?php echo $attn ?>
<br />
Message:<br />
<?php $notesout = str_replace("\r", "<br/>", $notes);
echo $notesout; ?>
<br />
<?php echo $ip ?>

<br /><br />
<a href="contact.php"> Next Page </a>
</p>

</body>
</html>

Link to comment
https://forums.phpfreaks.com/topic/180720-solved-form-to-email/#findComment-953545
Share on other sites

Update message to

$message = "$todayis [EST] \n
Attention: $attn \n
Message: $notes \n
From: $visitor ($visitormail)\n
Additional Info : IP = $ip \n
Browser Info: $httpagent \n
Referral : $httpref \n
Name on the Graphic : $name \n
Image on the Graphic  : $image \n
Size of Graphic (Leave this blank if you want me to pick a size out for you.) : $size \n
Font (Leave this blank if you want me to pick one out. If you want to pick one out get it from. <a href=\"http://www.dafont.com/\">Dafont</a>) : $font \n";

Link to comment
https://forums.phpfreaks.com/topic/180720-solved-form-to-email/#findComment-953557
Share on other sites

  Quote

Update message to

$message = "$todayis [EST] \n
Attention: $attn \n
Message: $notes \n
From: $visitor ($visitormail)\n
Additional Info : IP = $ip \n
Browser Info: $httpagent \n
Referral : $httpref \n
Name on the Graphic : $name \n
Image on the Graphic  : $image \n
Size of Graphic (Leave this blank if you want me to pick a size out for you.) : $size \n
Font (Leave this blank if you want me to pick one out. If you want to pick one out get it from. <a href=\"http://www.dafont.com/\">Dafont</a>) : $font \n";

Lol, thank you. That fixed it. Just had to recode allot of it lol.
Link to comment
https://forums.phpfreaks.com/topic/180720-solved-form-to-email/#findComment-953568
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.