0

Hello Guys!
I need A help for Auto email Generation when A form is submitted. A email Should Send to the web site Admin or wotever from Who filled the form, Form Filled Details! Please Help Me I Tried Many Ways but Still couldnt.. Please Help. and form details are on database!

3
Contributors
7
Replies
32
Views
4 Years
Discussion Span
Last Post by irfath
0

When you say that;

I Tried Many Ways but Still couldnt..

What exactly did you try?? Can you share with us?

0

I refferes sme tutorials on Web But I couldnt, Im new to Php though Please any help

0

I followed Some Tutorials on W3School.com But i couldn't email is not generatin??

0
<?php
if (isset($_REQUEST['email']))
//if "email" is filled out, send email
  {
  //send email
  $email = $_REQUEST['email'] ;
  $subject = $_REQUEST['subject'] ;
  $message = $_REQUEST['message'] ;
  mail("irfathft@yahoo.com", $subject,
  $message, "From:" . $email);
  echo "Thank you for using our mail form";
  }
else
//if "email" is not filled out, display the form
  {
  echo "<form method='post' action='emailgene.php'>
  Email: <input name='email' type='text'><br>
  Subject: <input name='subject' type='text'><br>
  Message:<br>
  <textarea name='message' rows='15' cols='40'>
  </textarea><br>
  <input type='submit'>
  </form>";
  }
?>
0

Try this one. It should work.
But first, you'll need to download the phpMailer class, and then create your HTML form with Name, subject, message; just as shown in the code below

<?php
require("PHPMailer_5.2.4/class.phpmailer.php");
    $mail = new PHPMailer();
    $mail->IsSMTP();
    $mail->Host = "localhost";
    $mail->From = "source_address@domain.com";
    $mail->FromName  =  "Name of sender";
    $email_add = $_POST['email'];
    $name = $_POST['name'];
    $subject = $_POST['subject'];
    $msg = $_POST['email_message']."\n".$name.".";
    $mail->AddAddress("add_address@domain.com");
    $mail->AddAddress("address2@domain.com");

    $mail->SMTPAuth = "true";
    $mail->Username = "my_gmail_address@gmail.com";
    $mail->Password =  "my_gmail_password";
    $mail->Port  =  "25";

    $mail->name = $name;
    $mail->Subject = $subject;
    $mail->Body = $msg;
    $mail->WordWrap = 50;

    if(!$mail->Send())
    {
echo "<script language='javascript'>
alert('Your email was NOT sent! Please try again.')
</script>
<script>
window.location='index.php'
</script>";
    }
    else
    {
    echo "<script language='javascript'>
alert('Mail Successfully sent! Thank you for contacting us.')
</script>
<script>
window.location='index.php'
</script>";
    }

?>

Edited by Webville312

0

Webville312 Thak you very much For your help Your Code You mentioned this
$mail->AddAddress("add_address@domain.com");
$mail->AddAddress("address2@domain.com");
What is this means> please

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.