Jump to content

Emailing A Form


enemeth

Recommended Posts

You're looking for the mail() function.

http://us2.php.net/mail

 

Just POST (method="post") the form fields and manipulate them for teh function.

Take a look at that if you you get stuck or something isn't working, just come back and we'll work it out. ;)

 

Link to comment
https://forums.phpfreaks.com/topic/54993-emailing-a-form/#findComment-271887
Share on other sites

Simple !

 

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 = "the persons email address here, this is the person who fills the form";

$mail->FromName = 'his display name'; // the username, this you can get from the $_POST['firstname'] depending on how you design the form';

 

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

 

create an html page, say content.html, you need not save this page also, are you using dreamweaver  or frontpage ?.. what ever it is, create the format of how you want the email to be.

place the variable name or the array name on the area where you want to display the value of the form

 

example

First name  -  <?=$fname?>  or if its array First name <?=$arr_vars[0]?>

 

Last neme  <?=lname?>

 

etcetra....

 

after you finished designing the page, select all, then copy it

 

come to the emaime.php

create a variable, say $body,

$body = '( copy thecontents here)'  within the quotes,

 

make sure the php variables are concatenated properly.

 

assign the $boby to

$mail->Body = $body

then

$mail->Subject = 'Subect here'

 

then .. you are finished

 

$mail->Send();

 

upto you to handle the error

 

............................................................

 

this will help you only if you know something about php and already worked with php...

 

~J

 

 

Link to comment
https://forums.phpfreaks.com/topic/54993-emailing-a-form/#findComment-271893
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.