Jump to content

Php emailer help


perezf

Recommended Posts

i cant seem to figure out what is going wrong im sure it is something simple

but the email function is not working

[code]<div align="center">
<form name="form1" method="post" action="">
  <p>Your Name:<br>
    <input name="name" type="text" size="50">
  </p>
  <p>Your Email:<br>
    <input name="from" type="text" size="50">
  </p>
  <p>Your Question:<br>
    <textarea name="contents" cols="50" rows="5"></textarea>
  </p>
  <p>
    <input type="submit" name="Submit" value="Submit"> 
    </p>
</form></div>

<?php

if(isset($_POST['Submit'])){}else{

$to = "[email protected]";
$subject = "Question from DoitYourself";
$from_header = "From: $from";


  mail($to, $subject, $contents, $from_header);



echo "Thank You for using the 2fr3sh emailer the messages have been sent!";
};

?>[/code]
Link to comment
https://forums.phpfreaks.com/topic/17945-php-emailer-help/
Share on other sites

you have your isset function wrong. Also if you have globals turned off, which they are by default, you cannot just use $from.

try this
[code]
<?php
if(isset($_POST['Submit'])){
$to = "[email protected]";
$subject = "Question from DoitYourself";
$from_header = "From: $_POST['from']";


  mail($to, $subject, $contents, $from_header);



echo "Thank You for using the 2fr3sh emailer the messages have been sent!";
} else {
?>
<div align="center">
<form name="form1" method="post" action="">
  <p>Your Name:<br>
    <input name="name" type="text" size="50">
  </p>
  <p>Your Email:<br>
    <input name="from" type="text" size="50">
  </p>
  <p>Your Question:<br>
    <textarea name="contents" cols="50" rows="5"></textarea>
  </p>
  <p>
    <input type="submit" name="Submit" value="Submit"> 
    </p>
</form></div>

<?
}
?>[/code]

Link to comment
https://forums.phpfreaks.com/topic/17945-php-emailer-help/#findComment-76731
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.