am working on a website for my client, i want the application to read the content of the html and send an email to the customer's email, but i want to display some variables which the customer entered in the html content and send it via email. This is my code.
this is the html code:
<p> {$cname} </p>
<p> Thank you for contacting our support team. A support ticket has now been opened for your request. You will be notified when a response is made by email. The details of your ticket are shown below. </p>
<p> Subject: {$sub} <br />
Priority: {$prio} <br />
Status: Open </p>
<p> Thanks as always for being our customer.<br />
<br />
Regards,</p></td>
this is my php code:
<?php
//error_reporting(E_ALL);
error_reporting(E_STRICT);
date_default_timezone_set('America/Toronto');
require_once('../class.phpmailer.php');
//include("class.smtp.php"); // optional, gets called from within class.phpmailer.php if not already loaded
$_SESSION['studentid'] = $_POST['sid'];
$_SESSION['cname'] = $_POST['namee'];
$_SESSION['email'] = $_POST['email'];
$_SESSION['department'] = $_POST['department'];
$_SESSION['priority'] = $_POST['priority'];
$_SESSION['subjectd'] = $_POST['subject'];
$_SESSION['commentc'] = $_POST['message'];
$cname =$_SESSION['cname'];
$detailz = $_SESSION['commentc'];
$email = $_SESSION['email'];
$cname = $_SESSION['cname'];
$ip = getenv("REMOTE_ADDR");
$prio =$_SESSION['priority'];
$stid = $_SESSION['studentid'];
$dept = $_SESSION['department'];
$sub = $_SESSION['subjectd'];
$mail = new PHPMailer();
$body = file_get_contents('contents.html');
$body = preg_replace('/[\]/','',$body);
$mail->IsSMTP(); // telling the class to use SMTP
$mail->Host = $row_prs['shost']; // SMTP server
$mail->SMTPDebug = 2; // enables SMTP debug information (for testing)
// 1 = errors and messages
// 2 = messages only
$mail->SMTPAuth = true; // enable SMTP authentication
$mail->Host = $row_prs['shost']; // sets the SMTP server
$mail->Port = $row_prs['portx']; // set the SMTP port for the GMAIL server
$mail->Username = $row_prs['susername']; // SMTP account username
$mail->Password = $row_prs['spassword']; // SMTP account password
$mail->SetFrom($row_pr['from'], $row_pr['sname']);
//$mail->AddReplyTo("name#yourdomain.com","First Last");
$mail->Subject = "[Ticket ID:" .$tno."]".$sub;
$mail->AltBody = "To view the message, please use an HTML compatible email viewer!"; // optional, comment out and test
$mail->MsgHTML($body);
$address = $_SESSION['emid'];
$mail->AddAddress($address, "John Doe");
//$mail->AddAttachment("images/phpmailer.gif"); // attachment
//$mail->AddAttachment("images/phpmailer_mini.gif"); // attachment
if(!$mail->Send()) {
echo "Mailer Error: " . $mail->ErrorInfo;
} else {
echo "Message sent!";
}
?>
Try this,
<p> <?php echo $cname; ?> </p>
<p> Thank you for contacting our support team. A support ticket has now been opened for your request. You will be notified when a response is made by email. The details of your ticket are shown below. </p>
<p> Subject: <?php echo $sub; ?> <br />
Priority: <?php echo $prio; ?> <br />
Status: Open </p>
<p> Thanks as always for being our customer.<br />
<br />
Regards,</p></td>
You are store the data in session. So you can use those to show it back. Use this
<p> <?php echo $_SESSION['cname'] ?> </p>
<p> Thank you for contacting our support team. A support ticket has now been opened for your request. You will be notified when a response is made by email. The details of your ticket are shown below. </p>
<p> Subject: <?php echo $_SESSION[' subjectd'] ?> <br />
Priority: <?php echo $_SESSION['priority'] ?> <br />
Status: Open </p>
<p> Thanks as always for being our customer.<br />
<br />
Regards,</p>
Your data already sotred in session. So till session get distroyed you can use those variable as well.
some ref , but is just replace test '{$XXX}' , not are real php var
$replace_values = array(
'$cname' => $_SESSION['cname'],
);
$result = preg_replace_callback('!\{(\$\w+)\}!', function($ma) use ($replace_values) {
if(isset($ma[1]) && isset($replace_values[$ma[1]])){
return $replace_values[$ma[1]];
}
return '';
}, $body);
https://eval.in/409962
this is the code that worked, I just want to say thank you to you guys that answered my question but i just want a BIG THANK YOU to JOE LEE. I own you a bottle of beer. Respect
///to get the content of the html and replace it with the variables
$body = file_get_contents('contents.html');
$replace_values = array(
'$cname' => $_SESSION['cname'],
'$prio' => $_SESSION['priority'],
'$sub' => $_SESSION['subjectd'],
);
$result =preg_replace_callback('!\{(\$\w+)\}!', function($ma) use ($replace_values) {
if(isset($ma[1]) && isset($replace_values[$ma[1]])){
return $replace_values[$ma[1]];
}
return '';
}, $body);
////
$mail->IsSMTP(); // telling the class to use SMTP
$mail->Host = $row_prs['shost']; // SMTP server
//$mail->SMTPDebug = 1; // enables SMTP debug information (for testing)
// 1 = errors and messages
// 2 = messages only
$mail->SMTPAuth = true; // enable SMTP authentication
$mail->Host = $row_prs['shost']; // sets the SMTP server
$mail->Port = $row_prs['portx']; // set the SMTP port for the GMAIL server
$mail->Username = $row_prs['susername']; // SMTP account username
$mail->Password = $row_prs['spassword']; // SMTP account password
$mail->SetFrom($row_prs['from'], $row_prs['sname']);
//$mail->AddReplyTo("name#yourdomain.com","First Last");
$mail->Subject = "[Ticket ID:" .$tno."]".$sub;
$mail->AltBody = "To view the message, please use an HTML compatible email viewer!"; // optional, comment out and test
$mail->MsgHTML($result);
Related
Im trying to use PHPMailer and been getting an error that the Message body empty or the screen is blank and does not print that the message has been sent. My folder structure is everything is in the same folder for testing in case anyone needs to know. I have also followed this post but did not seem to work. PHPMailer Mailer Error: Message body empty
<html>
<head>
<title>PHPMailer - SMTP (Gmail) basic test</title>
</head>
<body>
<?php
//error_reporting(E_ALL);
error_reporting(E_STRICT);
date_default_timezone_set('America/Toronto');
require_once('class.phpmailer.php');
//include("class.smtp.php"); // optional, gets called from within class.phpmailer.php if not already loaded
$mail = new PHPMailer();
$body = file_get_contents('contents.html');
echo $body;
//$body = preg_replace('/[\]/','',$body);
//$body = "To view the message, please use an HTML compatible email viewer!";
$mail->IsSMTP(); // telling the class to use SMTP
$mail->Host = "mail.yourdomain.com"; // SMTP server
$mail->SMTPDebug = 1; // enables SMTP debug information (for testing)
// 1 = errors and messages
// 2 = messages only
$mail->SMTPAuth = true; // enable SMTP authentication
$mail->SMTPSecure = "ssl"; // sets the prefix to the servier
$mail->Host = "smtp.gmail.com"; // sets GMAIL as the SMTP server
$mail->Port = 465; // set the SMTP port for the GMAIL server
$mail->Username = "no-reply#yourdomain.com"; // GMAIL username
$mail->Password = "xxx"; // GMAIL password
$mail->SetFrom('no-reply#yourdomain.com', 'First Last');
//$mail->AddReplyTo("name#yourdomain.com","First Last");
$mail->Subject = "PHPMailer Test Subject via smtp (Gmail), basic";
$mail->IsHTML(true);
$mail ->MsgHTML($body);
$mail->Body = $body;
//$mail->AltBody = "To view the message, please use an HTML compatible email viewer!"; // optional, comment out and test
//$mail->IsHTML(true);
$address = "someemail#yourdomain.com";
$mail->AddAddress($address, "John Doe");
//$mail->AddAttachment("images/phpmailer.gif"); // attachment
//$mail->AddAttachment("images/phpmailer_mini.gif"); // attachment
if(!$mail->Send()) {
echo "Mailer Error: " . $mail->ErrorInfo;
} else {
echo "Message sent!";
}
?>
</body>
</html>
Contents.html:
<body style="margin: 10px;">
<div style="width: 640px; font-family: Arial, Helvetica, sans-serif; font-size: 11px;">
<br>
<br>
This is a test of PHPMailer.<br>
<br>
This particular example uses <strong>HTML</strong>, with a <div> tag and inline<br>
styles.<br>
<br>
Also note the use of the PHPMailer logo above with no specific code to handle
including it.<br />
Included are two attachments:<br />
phpmailer.gif is an attachment and used inline as a graphic (above)<br />
phpmailer_mini.gif is an attachment<br />
<br />
PHPMailer:<br />
Author: Andy Prevost (codeworxtech#users.sourceforge.net)<br />
Author: Marcus Bointon (coolbru#users.sourceforge.net)<br />
</div>
</body>
I have put the echos in the code for troubleshooting to see if it is getting the data or not. I think this is honestly something to do with Gmail for the mail hosting. But its what they use. Thank you in advanced with any direction you can provide.
Chris
try this
<html>
<head>
<title>PHPMailer - SMTP (Gmail) basic test</title>
</head>
<body>
<?php
//error_reporting(E_ALL);
date_default_timezone_set('America/Toronto');
include "PHPMailer_5.2.4/class.phpmailer.php";
//include("class.smtp.php"); // optional, gets called from within class.phpmailer.php if not already loaded
$message='<body style="margin: 10px;">
<div style="width: 640px; font-family: Arial, Helvetica, sans-serif; font-size: 11px;">
<br>
<br>
This is a test of PHPMailer.<br>
<br>
This particular example uses <strong>HTML</strong>, with a <div> tag and inline<br>
styles.<br>
<br>
Also note the use of the PHPMailer logo above with no specific code to handle
including it.<br />
Included are two attachments:<br />
phpmailer.gif is an attachment and used inline as a graphic (above)<br />
phpmailer_mini.gif is an attachment<br />
<br />
PHPMailer:<br />
Author: Andy Prevost (codeworxtech#users.sourceforge.net)<br />
Author: Marcus Bointon (coolbru#users.sourceforge.net)<br />
</div>
</body>';
$mail = new PHPMailer();
//$body = file_get_contents('contents.html');
echo $message;
//$body = preg_replace('/[\]/','',$body);
//$body = "To view the message, please use an HTML compatible email viewer!";
$mail->IsSMTP(); // telling the class to use SMTP
$mail->Host = "mail.yourdomain.com"; // SMTP server
$mail->SMTPDebug = 1; // enables SMTP debug information (for testing)
// 1 = errors and messages
// 2 = messages only
$mail->SMTPAuth = true; // enable SMTP authentication
$mail->SMTPSecure = "ssl"; // sets the prefix to the servier
$mail->Host = "smtp.gmail.com"; // sets GMAIL as the SMTP server
$mail->Port = 465; // set the SMTP port for the GMAIL server
$mail->Username = "no-reply#yourdomain.com"; // GMAIL username
$mail->Password = "xxx"; // GMAIL password
$mail->SetFrom('no-reply#yourdomain.com', 'First Last');
//$mail->AddReplyTo("name#yourdomain.com","First Last");
$mail->Subject = "PHPMailer Test Subject via smtp (Gmail), basic";
$mail->IsHTML(true);
$mail ->MsgHTML($message);
$mail->Body = $message;
//$mail->AltBody = "To view the message, please use an HTML compatible email viewer!"; // optional, comment out and test
//$mail->IsHTML(true);
$address = "someemail#yourdomain.com";
$mail->AddAddress($address, "John Doe");
//$mail->AddAttachment("images/phpmailer.gif"); // attachment
//$mail->AddAttachment("images/phpmailer_mini.gif"); // attachment
if(!$mail->Send()) {
echo "Mailer Error: " . $mail->ErrorInfo;
} else {
echo "Message sent!";
}
?>
</body>
</html>
I have following piece of code. It returns message "send successfully " but we won't receive email at given gmail, Is this code right or have I missed something?
<?php
require("mailer/PHPMailerAutoload.php");
require("mailer/class.smtp.php");
require("mailer/class.phpmailer.php");
$name=$_POST['Your_Name'];
$email=$_POST['Your_Email'];
$message=$_POST['Your_Msg'];
echo $name ;
$mail = new PHPMailer();
// set mailer to use SMTP
//$mail->IsSMTP();
// As this email.php script lives on the same server as our email server
// we are setting the HOST to localhost
$mail->Host = "smtp.gmail.com"; // specify main and backup server
$mail->Port = "465";
$mail->SMTPAuth = true; // turn on SMTP authentication
$mail->Username = "mandarpatil0003#gmail.com"; // SMTP username
$mail->Password = "Con#Soumitra1"; // SMTP password
// $email is the user's email address the specified
// on our contact us page. We set this variable at
// the top of this page with:
// $email = $_REQUEST['email'] ;
$mail->From = $email;
// below we want to set the email address we will be sending our email to.
$mail->AddAddress("mandarpatil0003#gmail.com", "Mandar");
// set word wrap to 50 characters
$mail->WordWrap = 50;
// set email format to HTML
$mail->IsHTML(true);
$mail->Subject = "You have received feedback from your website!";
// $message is the user's message they typed in
// on our contact us page. We set this variable at
// the top of this page with:
// $message = $_REQUEST['message'] ;
$mail->Body = $message;
$mail->AltBody ="Name : {$name}\n\nEmail : {$email}\n\nMessage : {$message}";
if(!$mail->Send())
{
echo "Message could not be sent. <p>";
echo "Mailer Error: " . $mail->ErrorInfo;
exit;
}
else
{
echo "Thank you for contacting us. We will be in touch with you very soon.";
}
?>
Does this code have any problems or do I have to try a different approach?
<?php
include 'library.php'; // include the library file
include "classes/class.phpmailer.php"; // include the class name
include "classes/class.smtp.php";
if(isset($_POST["send"])){
$email = $_POST["email"];
$mail = new PHPMailer; // call the class
$mail->IsSMTP();
$mail->SMTPAuth = true; // turn on SMTP authentication
$mail->SMTPSecure = "ssl";
$mail->Host = "smtp.gmail.com"; //Hostname of the mail server
$mail->Port = 465; //Port of the SMTP like to be 25, 80, 465 or 587
$mail->SMTPDebug = 1;
//$mail->SMTPAuth = false; //Whether to use SMTP authentication
$mail->Username = "****#gmail.com"; //Username for SMTP authentication any valid email created in your domain
$mail->Password = "****"; //Password for SMTP authentication
$mail->AddReplyTo("****#gmail.com", "Reply name"); //reply-to address
$mail->SetFrom("****#gmail.com", "Your Name"); //From address of the mail
// put your while loop here like below,
$mail->Subject = "Your SMTP Mail"; //Subject od your mail
$mail->AddAddress($email, "Asif18"); //To address who will receive this email
$mail->MsgHTML("<b>Hi, your first SMTP mail has been received."); //Put your body of the message you can place html code here
//Attach a file here if any or comment this line,
$send = $mail->Send(); //Send the mails
if($send){
echo '<center><h3 style="color:#009933;">Mail sent successfully</h3></center>';
}
else{
echo '<center><h3 style="color:#FF3300;">Mail error: </h3></center>'.$mail->ErrorInfo;
}
}
?>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Send mails using SMTP and PHP in PHP Mailer using our own server or gmail server by Asif18</title>
<meta name="keywords" content="send mails using smpt in php, php mailer for send emails in smtp, use gmail for smtp in php, gmail smtp server name"/>
<meta name="description" content="Send mails using SMTP and PHP in PHP Mailer using our own server or gmail server"/>
<style>
.as_wrapper{
font-family:Arial;
color:#333;
font-size:14px;
}
.mytable{
padding:20px;
border:2px dashed #17A3F7;
width:100%;
}
</style>
<body>
<div class="as_wrapper">
<h1>Send mails using SMTP and PHP in PHP Mailer using our own server or gmail server</h1>
<form action="" method="post">
<table class="mytable">
<tr>
<td><input type="email" placeholder="Email" name="email" /></td>
</tr>
<tr>
<td><input type="submit" name="send" value="Send via SMTP" /></td>
</tr>
</table>
</form>
</div>
</body>
</html>
I know this is one of those things that gets asked a lot, but I'm not the most savvy web designer when it comes to more technical issues. The problem is this: on my website, www.imago-graphics.com, the email from the contact section doesn't go anywhere: neeither to my iPage inbox, nor my Google Apps email. I know it's probably an issue with the mail.php, but I'm not sure what it is. Here's the php (I've left the actual email address I want it to go to in the script (mariano#imago-graphics.com), but taken out the password; also, that address is a Google Apps email address, which I think might be part of the issue:
<?
require("class.phpmailer.php");
//form validation vars
$formok = true;
$errors = array();
//sumbission data
$ipaddress = $_SERVER['REMOTE_ADDR'];
$date = date('d/m/Y');
$time = date('H:i:s');
//form data
$name = $_POST['name'];
$email = $_POST['email'];
$subject = $_POST['subject'];
$message = $_POST['message'];
$mail = new PHPMailer();
$mail->IsSMTP(); // send via SMTP
$mail->Host = "smtp.gmail.com"; // SMTP server
$mail->SMTPAuth = true; // turn on SMTP authentication
$mail->Username = "mariano#imago-graphics.com"; // SMTP username
$mail->Password = "xxxxx"; // Password
$mail->From = "mariano#imago-graphics.com"; // SMTP username again
$mail->AddAddress("mariano#imago-graphics.com"); // Your Adress
$mail->Subject = "New mail from IMAGO Graphics";
$mail->IsHTML(true);
$mail->CharSet = 'UTF-8';
$mail->Body = "<p>You have recieved a new message from the enquiries form on your website.</p>
<p><strong>Name: </strong> {$name} </p>
<p><strong>Email Address: </strong> {$email} </p>
<p><strong>Subject: </strong> {$subject} </p>
<p><strong>Message: </strong> {$message} </p>
<p>This message was sent from the IP Address: {$ipaddress} on {$date} at {$time}</p>";
if(!$mail->Send())
{
echo "Mail Not Sent <p>";
echo "Mailer Error: " . $mail->ErrorInfo;
exit;
}
echo "Mail Sent";
?>
There are a few more params that you need to set to be able to send from a Gmail account. Please check their documentation on most up to date SMTP settings that you need to use.
These are couple things you have to have:
$mail->Username = "mariano#imago-graphics.com";
$mail->Password = "xxxxx";
$mail->SMTPSecure = "tls";
$mail->Host = "smtp.gmail.com";
$mail->Port = 587;
During testing enable debug mode so you can see if the errors if there are any:
$mail->SMTPDebug = 2;
I have tried every hint I have found across the web and here but what I cannot achieve is for the sent email to contain the form data in the html formatted message. The mailing function is working and I get the email properly.
The form is basically:
<form method="post" action="test.php" name="Work Record" autocomplete="off">
<input type="text" name="first_name" id="staff_name2" placeholder="First" required />
<input type="text" name="last_name" id="staff_name" placeholder="Last" required />
<input name="checkbox" type="checkbox" class="head-l" id="checkbox" onChange="this.form.submit()">
And using the latest phpmailer from google the action script is as follows. I have the emailing function working through gmail, I am just not sure what to put where to pull the data from the form and put it into the email body. The code that is pasted in the body now is that we used to use before switching to phpmailer. Thank you!
<?php
require '/home/newnplhftp/nplh.us/smtp/phpmailer/class.phpmailer.php';
$mail = new PHPMailer;
$mail->IsSMTP(); // Set mailer to use SMTP
$mail->Host = 'smtp.gmail.com'; // Specify main and backup server
$mail->SMTPAuth = true; // Enable SMTP authentication
$mail->Username = 'xxxxxxxxxxxxxxxx'; // SMTP username
$mail->Password = 'xxxxxxxxx'; // SMTP password
$mail->SMTPSecure = 'ssl'; // Enable encryption, 'ssl' also accepted
$mail->Port = 465; // set the SMTP port for the GMAIL server
$mail->From = 'xxxxxxxxxxxxxx';
$mail->FromName = 'NPLH';
$mail->AddAddress('xxxxxxxxxxxxxxxxxxxxx'); // Name is optional
$mail->AddCC('');
$mail->AddBCC('');
$mail->WordWrap = 50; // Set word wrap to 50 characters
$mail->IsHTML(true); // Set email format to HTML
$mail->Subject = 'xxxxxxxxxxxxxxx';
$mail->Body = '
<html>
<h2><b>$first_name $last_name, $license_type</b></h2>
</html>';
$mail->AltBody = '';
if(!$mail->Send()) {
echo 'Message could not be sent.';
echo 'Mailer Error: ' . $mail->ErrorInfo;
exit;
}
echo 'Thank you, your message has been sent!';
?>
Please set;
$mail->Body = '
<html>
<h2><b>$first_name $last_name, $license_type</b></h2>
</html>';
to
$first_name = $_POST['first_name'];
$last_name = $_POST['last_name'];
$license_type = $_POST['license_type'];
$mail->Body = "
<html>
<h2><b>".$first_name." ".$last_name.", ".$license_type."</b></h2>
</html>";
The variables you are trying to send need to be captured from the the form first. This would happen on test.php since this is where you are posting the values to.
So you would do this
$first_name = $_POST['first_name'];
$last_name = $_POST['last_name'];
$license_type = $_POST['license_type'];
Then you can use them inside the mail body.
$mail->Body = "<html><h2><b>$first_name $last_name, $license_type</b></h2></html>";
Though I would highly suggest validating that data in some way first.
I have some PHP code that I'm using to send email to a specific e-mail address. However, I'd like to include a couple more e-mail addresses in the PHP for when it sends it.
when i tried it showing the following
ERROR:Mailer Error: You must provide at least one recipient email address.
code
include "class.phpmailer.php"; // include the class file name
$mail = new PHPMailer(); // create a new object
$mail->IsSMTP(); // enable SMTP
$mail->SMTPDebug = 1; // debugging: 1 = errors and messages, 2 = messages only
$mail->SMTPAuth = true; // authentication enabled
//$mail->SMTPSecure = 'ssl'; // secure transfer enabled REQUIRED for GMail
$mail->Host = "mail.authsmtp.com";
$mail->Port = "25"; // or 587
$mail->IsHTML(true);
$mail->Username = "xxxxx";
$mail->Password = "xxxxx";
$mail->SetFrom("cpn#xxxxxxx.com");
$mail->Subject = $sub1;
$mail->Body = $text_mail;
$mail->AddAddress("xxxxxxx#gmail.com;aral#xxxxxx.com;akhader#xxxxxx.com");
if(!$mail->Send()){
echo "Mailer Error: " . $mail->ErrorInfo;
}
else{
echo "Message has been sent";
}
any one guide me how to do it
Change this line
$mail->AddAddress("xxxxxxx#gmail.com;aral#xxxxxx.com;akhader#xxxxxx.com");
to this:
$mail->AddAddress("xxxxxxx#gmail.com");
$mail->AddAddress("aral#xxxxxx.com");
$mail->AddAddress("akhader#xxxxxx.com");
You can run that function as many times as you like until you've got all the addresses you need.
See Here for more info
It seems that you are miss using the AddAdress method. You should pass every mail separatly like that :
$mail->AddAddress("xxxxxxx#gmail.com");
$mail->AddAddress("aral#xxxxxx.com");
$mail->AddAddress("akhader#xxxxxx.com");
See PHPMailer AddAddress() for more details.
If you want to send email to multiple address, You need to call the AddAddress() function for each and every Email address. First parameter is EMAIL address, Second one is Recipient name and it is optional.
$mail->AddAddress("xxxxxxx#gmail.com", "XXXXXXXX");
$mail->AddAddress("aral#xxxxxx.com", "Aral");
Try this
$mail->AddAddress("xxxxxxx#gmail.com");
$mail->AddAddress("aral#xxxxxx.com");
$mail->AddAddress("akhader#xxxxxx.com");
Take a look here PHPMailer AddAddress()
and keep an eye of your line:
$mail->AddAddress("xxxxxxx#gmail.com;aral#xxxxxx.com;akhader#xxxxxx.com");
Instead of:
$mail->AddAddress("xxxxxxx#gmail.com;aral#xxxxxx.com;akhader#xxxxxx.com");
You should use
$mail->AddAddress('xxxxxxx#gmail.com', '1');
$mail->AddAddress('aral#xxxxxx.com', '2');
$mail->AddAddress('akhader#xxxxxx.com', '3');
Or use CC copies:
$mail->AddCC('xxxxxxx#gmail.com', '1');
$mail->AddCC('aral#xxxxxx.com', '2');
$mail->AddCC('akhader#xxxxxx.com', '3');
Try this.... This may help you
<html>
<body>
<?php
if (isset($_REQUEST['email']))
//if "email" is filled out, send email
{
//send email
$email = $_REQUEST['email'] ;
$subject = $_REQUEST['subject'] ;
$message = $_REQUEST['message'] ;
mail("chauhanamrish32#gmail.com,amrinderpuri1990#gmail.com,amrinder_puri#yahoo.com,amrindersinghpuri13#gmail.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='mail.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>";
}
?>