Jump to content

Sending HTML Form Mail


tyty1993

Recommended Posts

Can anyone help me out with this? I got all the SENDMAIL_PATH right and all that, it's the php part I think is wrong. Here is the code:

<?php
$email = $_POST['email'];
$problem = $_POST['problem'];

//recepients
$to = '[email protected]';
//subject
$subject = 'New Problem Submitted!';
//message
$message = "
<br><hr><br>
$email has submitted a problem regarding the Hilo High Robotics Website. Here is his/her comply:<br><br>
$problem<br><br>
This is obviously an automatically generated email and now that you know the problem, you or someone you know must fix it.<br>
";
// To send HTML mail, the Content-type header must be set
$headers = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
// Additional headers
$headers .= 'To: Webmaster <[email protected]>'. "\r\n";
$headers .= 'From: Webmaster <[email protected]>' ."\r\n";
mail($to, $subject, $message, $headers);
include("confirm.php");
?>

 

Here is the HTML

<form action="processform.php" method="POST">
<table cellspacing="5" cellpadding="0">
<tr>
<td align="left">
E-Mail
</td>
<td align="left">
<input type="text" name="email" id="email" size="15">
</td>
</tr>
<tr>
<td align="left">
State the problem:
</td>
<td align="left">
<textarea name="problem" id="problem" cols="45" rows="5"></textarea>
</td>
</tr>
<tr>
<td align="left">
<input type="submit" value="Submit">
</td>
</tr>
</table>
</form>

 

Can anyone help?

Link to comment
https://forums.phpfreaks.com/topic/104509-sending-html-form-mail/
Share on other sites

There are two common problems with mail scripts. The first was just mentioned...

 

System Configuration: From what you have said so far, I am going to assume this is your personal server (not a hosting service) and you are running Linux. Before you configure PHP to use sendmail, you have to configure sendmail. Basically, you need to have an outgoing SMTP server to relay messages through. Do a google search on how to configure sendmail to use SMTP. To test if sendmail is working, running something like this from the system command line:

cat /etc/issue | mail -s "System Info" "[email protected]"

 

Hosting server filters: If you are using a hosting service, they may be filtering the email if it has an 'unapproved' From header. Try using a From email that has the same domain as the webserver.

 

oh...and obviously check your spam filter on your email address....and make sure the TO and FROM are different

Did you try this:

Hosting server filters: If you are using a hosting service, they may be filtering the email if it has an 'unapproved' From header. Try using a From email that has the same domain as the webserver.

 

If that still doesn't work, just give your hosting service a call. Every server configuration is different and they'll be able to help you best on why the code isn't working (cus it should). You pay them for support, don't hesitate to use it!

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.