Jump to content

Recommended Posts

I am having trouble with the email function, basicaly I am not getting any emails submited via the form. Here is my script:

 

  <?php if( in("send") != "send" ) {?>

      <form action="<?php echo $_SERVER['PHP_SELF']; ?>" METHOD="POST">
      Name :<br><input name="name" type="text" id="name" size="35" /><br>
      Email :<br><input name="email" type="text" id="email" size="35" /><br>
     Question:<br>
      <textarea name="question" cols="27" rows="5" id="question" ></textarea>
      <br>
	  <input type="submit" name="send" id="send" value="send" />
	  </form>

          <?php } else { ?>
 <strong>Email was submited</strong>
       <br>
           <a href="index.php">Previous page.</a>

	  <?php } ?>	

 

The function is included on top of the page, before any html:

 

<?php
if(in("send"))
{
      $name = $_POST['name']; 
      $email = $_POST['email']; 
      $question = $_POST['question']; 
  
     $sendto = "________@hotmail.com";
     $subject = "Question";
     $headers = "From: " .  $name; 
     $ip=@$REMOTE_ADDR; 
     $message =  "Name: " . $name  . "\n" . "Email  : " . $email . "\n" . "Question : " .  $question . "\n" . "IP : " . $ip;

     mail($sendto, $subject, $message, $headers);
}
?>

 

What is wrong with this ?

Link to comment
https://forums.phpfreaks.com/topic/54890-email-form/
Share on other sites

You use in(), which isnt a function (according to php.net).

 

Use if(isset($_POST['send'])) or something similair instead.

 

Good luck.

 

Full-Demon

 

PS, for sending email, I would suggest you use swfit mailer, a library for sending mails, as the build in mail() is a bad function!

 

 

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

I noticed that when I change where the email will go to the form works 100%.

 

I changed the destenation email address to administrator@____.org (my website) and I got every message submited via that form)

 

But when the destenation email address is yahoo or hotmail I do not get any emails, even in the junk folders.

 

I also have email fowarding on that administrator@____.org account so that every email sent there is fowarded to my hotmail account, but the emails generated by the form are not fowarded.

 

What could be the reason for this ?

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

may be  you can use the following procedure

 

get the PHPMailer, search in google to download it.

 

put the files in a folder,

create a file, say emailme.php, for mailing the contents

inlcude the class.phpmailer.php on the first line

 

instantiate the object like this

 

  $mail = new PHPMailer();

  $mail->IsHTML(true);

  $mail->IsSMTP(); // telling the class to use SMTP

  $mail->Host = "localhost"; // SMTP server

  $mail->From = "from email address here";

  $mail->FromName = 'display name here';

 

you can also copy the above code to the file after the inlcude code.

 

store the values of the form using the Post methos to the variable or the array

 

 

assign the content like this

 

$mail->Body = 'content of the mail'

then

$mail->Subject = 'Subect here'

 

then .. you are finished

 

$mail->Send();

 

upto you to handle the error

 

this is the perfect mailer ever !!

 

~J

 

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

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.