How to create email form PHP (HTML5) [duplicate] - php

This question already has answers here:
How can I send an email using PHP?
(20 answers)
Closed 6 years ago.
I'm a little bit new with with php and i just want to ask how can i make the the "Send Message" button send the inputted information on the form i created to my email.
Here's the code:
<section id="three">
<h2>Email Me!</h2>
<p>You will receive a reply within 24-48 hours.</p>
<div class="row">
<div class="8u 12u$(small)">
<form method="post" action="MAILTO:sample#email.com">
<div class="row uniform 50%">
<div class="6u 12u$(xsmall)"><input type="text" name="name" id="name" placeholder="Name" /></div>
<div class="6u$ 12u$(xsmall)"><input type="email" name="email" id="email" placeholder="Email" /></div>
<div class="12u$"><textarea name="message" id="message" placeholder="Message" rows="4"></textarea></div>
</div>
</form>
<ul class="actions">
<li><input type="submit" value="Send Message" /></li>
</ul>
</div>
<div class="4u$ 12u$(small)">
<ul class="labeled-icons">
<li>
<h3 class="icon fa-home"><span class="label">Address</span></h3>
1234 Somewhere Rd.<br />
Nashville, TN 00000<br />
United States
</li>
<li>
<h3 class="icon fa-mobile"><span class="label">Phone</span></h3>
000-000-0000
</li>
<li>
<h3 class="icon fa-envelope-o"><span class="label">Email</span></h3>
hello#untitled.tld
</li>
</ul>
</div>
</div>
</section>
Thanks!

I'm not quite sure but email from php server almost all of them ends up in spam folder (trust issues by mail provider). But if you're interested, you can send mail via email function:
<?php
$to = 'nobody#example.com';
$subject = 'the subject';
$message = 'hello';
$headers = 'From: webmaster#example.com' . "\r\n" .
'Reply-To: webmaster#example.com' . "\r\n" .
'X-Mailer: PHP/' . phpversion();
mail($to, $subject, $message, $headers);
?>
source: PHPDocs
Returns TRUE if the mail was successfully accepted for delivery, FALSE otherwise.
What I recomend using is Mail sending servive like SendGdrid or MailChimp, those are easy to use and have pretty simpe API to work with. Free plan has a lot to offer, And you can send plain html through their api and it will be fine.

<?php
if(isset($_POST['submit'])) // on submit click no need to action of the form
{
$name = $_POST['name'];
$email = $_POST['email'];
$to = "somebody#example.com";
$subject = "My subject";
$body = "name:" . $name . "Email:" . $email;
$headers = "From: webmaster#example.com" . "\r\n" .
"CC: somebodyelse#example.com";
mail($to,$subject,$body,$headers);
}
?>

I would recommend using PHPMailer to send email from PHP. Here's the steps to accomplish this.
Go to the Github repository.
Download the ZIP.
Extract it in your public_html directory.
include '/path/to/PHPMailer/PHPMailerAutoload.php'; at the top of your PHP script.
Get the values from the HTML form like you normally would.
Here's an example...
index.html
<form action="index.php" method="post">
<input type="email" name="email">
<input type="text" name="name">
<input type="text" name="subject">
<input type="text" name="message">
</form>
index.php
include '/path/to/PHPMailer/PHPMailerAutoload.php';
$email = $_POST['email'];
$name = $_POST['name'];
$subject = $_POST['subject'];
$message = $_POST['message'];
$mail = new PHPMailer;
$mail->isSMTP(); // Set mailer to use SMTP
$mail->Host = 'localhost'; // Specify main and backup SMTP servers
$mail->SMTPAuth = true; // Enable SMTP authentication
$mail->Username = 'username'; // SMTP username
$mail->Password = 'password'; // SMTP password
$mail->SMTPSecure = 'tls'; // Enable TLS encryption, "ssl" also accepted
$mail->Port = 587; // TCP port to connect to
$mail->setFrom('your email', 'your name'); // from
$mail->addAddress($email, $name); // to
$mail->isHTML(true); // if html
$mail->Subject = $subject;
$mail->Body = $message; //HTML
if($mail->send()){
echo 'Mail sent!';
}
else {
echo 'Mail failed!';
}

Related

Hi, I am trying to identify why this contact form won't send. Is already on the server and after I press Send message nothing comes through

The contact details are not sending. I will appreciate if anyone has any idea what I am doing wrong. The website is already live and I have used the correct email address in PHP. Not sure 100 if there is any info that will go into head of the HTML contact form.
Thanks
HTML Code:
<div class="row">
<div class="col-12">
<br>
<h2 class="contact-title">Get in Touch</h2>
</div>
<div class="col-lg-8">
<form class="form-contact contact_form" action="contact_process.php" method="post" id="contactForm"
novalidate="novalidate">
<div class="row">
<div class="col-12">
<div class="form-group">
<textarea class="form-control w-100" name="message" id="message" cols="30" rows="9"
onfocus="this.placeholder = ''" onblur="this.placeholder = 'Enter Message'"
placeholder='Enter Message'></textarea>
</div>
</div>
<div class="col-sm-6">
<div class="form-group">
<input class="form-control" name="name" id="name" type="text" onfocus="this.placeholder = ''"
onblur="this.placeholder = 'Enter your name'" placeholder='Enter your name'>
</div>
</div>
<div class="col-sm-6">
<div class="form-group">
<input class="form-control" name="email" id="email" type="email" onfocus="this.placeholder = ''"
onblur="this.placeholder = 'Enter email address'" placeholder='Enter email address'>
</div>
</div>
<div class="col-12">
<div class="form-group">
<input class="form-control" name="subject" id="subject" type="text" onfocus="this.placeholder = ''"
onblur="this.placeholder = 'Enter Subject'" placeholder='Enter Subject'>
</div>
</div>
</div>
<div class="form-group mt-3">
<a href="#" class="btn_3 button-contactForm" >Send Message</a>
</div>
</form>
</div>
PHP Code:
<?php
$to = "i have used a correct email address";
$from = $_REQUEST['email'];
$name = $_REQUEST['name'];
$subject = $_REQUEST['subject'];
$number = $_REQUEST['number'];
$cmessage = $_REQUEST['message'];
$headers = "From: $from";
$headers = "From: " . $from . "\r\n";
$headers .= "Reply-To: ". $from . "\r\n";
$headers .= "MIME-Version: 1.0\r\n";
$headers .= "Content-Type: text/html; charset=ISO-8859-1\r\n";
$subject = "You have a message from your Bitmap Photography.";
$logo = 'img/logo.png';
$link = '#';
$body = "<!DOCTYPE html><html lang='en'><head><meta charset='UTF-8'><title>Express Mail</title>
</head><body>";
$body .= "<table style='width: 100%;'>";
$body .= "<thead style='text-align: center;'><tr><td style='border:none;' colspan='2'>";
$body .= "<a href='{$link}'><img src='{$logo}' alt=''></a><br><br>";
$body .= "</td></tr></thead><tbody><tr>";
$body .= "<td style='border:none;'><strong>Name:</strong> {$name}</td>";
$body .= "<td style='border:none;'><strong>Email:</strong> {$from}</td>";
$body .= "</tr>";
$body .= "<tr><td style='border:none;'><strong>Subject:</strong> {$csubject}</td></tr>";
$body .= "<tr><td></td></tr>";
$body .= "<tr><td colspan='2' style='border:none;'>{$cmessage}</td></tr>";
$body .= "</tbody></table>";
$body .= "</body></html>";
$send = mail($to, $subject, $body, $headers);
?>
The contact details are not sending. I will appreciate if anyone has any idea what I am doing wrong. The website is already live and I have used the correct email address in PHP. Not sure 100 if there is any info that will go into head of the html contact form.
You have to make a couple of changes in your code to make the mail work. First you Have to change the code for the button. It must be like: <button type="submit"class="btn_3 button-contactForm">Send Message</button> you also have to change the code in the PHP file for sending the mail you have to remove the $send and make it just like mail($to, $subject, $body, $headers); You also have to note that not all hosting companies support the mail() PHP function. So make sure your web hosting provider supports the mail() function. If your hosting service does not support the PHP mail() function, you have to use the PHPMailer class. PHPMailer uses SMTP and sends the mail with the form data. You can download the PHPMailer class with composer. There are also other websites you can download that from. After you unzip the downloaded zip file, you would notice there is a folder named PHPMailer which has a lot of other PHP files inside it. You don't have to change any other PHP files. Make sure an autoload.php file is present in the folder, because the autoload.php file is the file which gets and combines all the necessary classes for the SMTP mail. After that, you have to upload the PHPMailer folder to your root directory in your server (with FTP for shared hosting or just copy paste for dedicated servers). First You have to create a gmail or any mail account through which the PHPMailer sends the mail. After creating an account, go to settings of the account and make sure 2 step authentication is disabled. After that also turn on Less Secure app, which you can do from here.
After doing all that, you have to create two PHP files which sends the form data, the first one will be contact_process.php as you mentioned above and the code for the php file will be:
<?php
use PHPMailer\PHPMailer\PHPMailer;
use PHPMailer\PHPMailer\Exception;
require 'phpmail/vendor/autoload.php';
if($_POST)
{
require('constant.php');
$user_name = filter_var($_POST["name"], FILTER_SANITIZE_STRING);
$user_email = filter_var($_POST["email"], FILTER_SANITIZE_EMAIL);
$subject = filter_var($_POST["subject"], FILTER_SANITIZE_STRING);
$msg = filter_var($_POST["msg"], FILTER_SANITIZE_STRING);
$mail = new PHPMailer(true);
// $mail->SMTPDebug = 0;
$mail->isSMTP();
$mail->SMTPAuth = true;
$mail->SMTPSecure = 'ssl';
$mail->Port = 465;
$mail -> Host = HOST; //this gets called from the constant.php
$mail->Username = USERNAME;
$mail->Password = PASSWORD;
$mail->From = $user_email;
$mail->FromName = $user_name;
$mail->addAddress(RECIPIENT_MAIL,RECIPIENT_MAIL_NAME); //this gets called from the constant.php do not change this
$mail->isHTML(true);
$mail->Subject = $subject;
$mail->Body = "New Response from website :\n\n<br>".
"Name: $user_name\n\n<br>".
"Email: $user_email \n\n<br>".
"Subject: $subject \n\n<br>".
"Message: \n\n <br>". "$msg\n\n<br>";
$mail->AltBody = "This is the plain text version of the email content";
if (!$mail->send()) {
echo json_encode(array('type'=>'error', 'text' => 'Try Again later')); //error sending form
exit;
} else {
//mail sent successfully
header("Location: thankyou.php");//change the link to the thank you page
exit;
}
}
?>
Now a constant.php file must be created where the reciepient and sender must be configured. The code for that will be:
<?php
// SMTP Configuration
define('HOST',"ssl://smtp.gmail.com");
define('USERNAME',"sending-mail#gmail.com"); //mail address of gmail you created
define('PASSWORD',"password-of-sending-mail-acc"); //password of gmail you created
// Recipient Configuration
define('RECIPIENT_MAIL',"recipient#gmail.com"); //enter mail address you want the form data to get received
define('RECIPIENT_MAIL_NAME',"Website"); //name of recipient
?>
Make sure all the files are in the root directory. You can also add the files to other directories but have to change the directory linking for the files.
For more Detailed documentation and source code you can see this.

Php form instead send mail download on computer

<div class="contact_form clearfix" id="Contact">
<h2>Hello... You can send me message to my universe here.</h2>
<img src="img/planeta1.png" alt="">
<form class="clearfix spaceForm" action="contactform.php" metod="post" >
<label for="name">Your name:</label>
<input type="text" name="name" id="name" placeholder="Jon Doe" required>
<label for="email">Your email:</label>
<input type="text" name="email" id="email" placeholder="something#mama.com" required>
<label for="subject">Subject</label>
<input type="text" name="subject" id="subject" required>
<label for="message">Your message:</label>
<textarea name="message" id="message" required></textarea>
<button type="submit" name="submit">Send mail</button>
</div>
and php code here...
<?php
if (isset($_POST['submit'])) {
$name = $_POST['name'];
$mailFrom = $_POST['email'];
$subject = $_POST['subject'];
$message = $_POST['message'];
$mailTo = "pisitenam#sammostalnisindikatstark.org.rs";
$headers = "From: ".$mailFrom;
$txt = "You have received an e-mail from " .$name.".\n\n".$message;
mail($mailTo, $subject, $txt, $headers);
header("Location: index.html");
}
?>
My contact form instead to send message download on computer as php file. I uploaded my site to netfly but stil doesnt work.
Can anybody help and give me a hint where is problem?
On XAMPP im getting blank page and mail is not sent. When I uploaded site on netfly site works fine but contact from when click submit start download php file where is code writen for controling contact form.5 day im trying to find solution for this problem and im geting tired :D So if anybody can help...
you are having some spell mistake in your form tag, first of all correct the method spell in your code as it is not correct so it can't redirect and post your data to contact form.
mail library contains various function.
for example:
<?php require 'PHPMailerAutoload.php';
$mail = new PHPMailer;
$mail->isSMTP(); // Set mailer to use SMTP
$mail->Host = 'your_smtp_domain.com'; // Specify main and backup SMTP servers
$mail->SMTPAuth = true; // Enable SMTP authentication
$mail->Username = 'user#example.com'; // SMTP username
$mail->Password = 'secret'; // SMTP password
$mail->SMTPSecure = 'tls'; // Enable TLS encryption, `ssl` also accepted
$mail->Port = 587; // TCP port to connect to
$mail->From = 'from#example.com';
$mail->FromName = 'Mailer';
$mail->addAddress('john#example.net', 'John doe'); // Add a recipient
$mail->isHTML(true); // Set email format to HTML
$mail->Subject = 'Here is the subject';
$mail->Body = 'This is the HTML message body <b>in bold!</b>';
if(!$mail->send()) {
echo 'Message could not be sent.';
echo 'Mailer Error: ' . $mail->ErrorInfo;
} else {
echo 'Message has been sent';
}
this can works for you if you use library.

HTML/PHP to send email from form [duplicate]

This question already has answers here:
PHP mail function doesn't complete sending of e-mail
(31 answers)
Closed 4 years ago.
I've been working on this for some time and am quite new to php. I'm having trouble getting this to send. A second set of eyes on this code would be most helpful:
<?php
if(isset($_POST['submit'])){
$to = "myEmail"; // this is your Email address
$from = $_POST['emailAddress']; // this is the sender's Email address
$fullName = $_POST['fullName'];
$subject = "Form submission";
$message = $fullName . " wrote the following:" . "\n\n" . $_POST['comment'];
$message2 = "Here is a copy of your message " . $fullName . "\n\n" . $_POST['comment'];
$headers = "From:" . $from;
$headers2 = "From:" . $to;
mail($to,$subject,$message,$headers);
mail($from,$subject2,$message2,$headers2); // sends a copy of the message to the sender
echo "Mail Sent. Thank you " . $fullName . ", we will contact you shortly.";
// You can also use header('Location: thank_you.php'); to redirect to another page.
}
?>
<form method="post" action="contact.php">
<div class="form-group">
<label for="fullName">Name</label>
<input type="text" class="form-control" id="fullName" name="fullName" placeholder="Jane Doe">
<label for="emailAddress">Email</label>
<input type="email" class="form-control" id="emailAddress" name="emailAddress" placeholder="jane.doe#example.com">
<label for="comment">Comment</label>
<textarea class="form-control" rows="3" name="comment" placeholder="Comment"></textarea>
<button name="submit" type="submit" class="btn">Submit</button>
</div>
</form>
Many thanks!
I would suggest to use PHPMailer. It is an open-source project available on GitHub : PHPMailer - GitHub
This class permits you to exploit the SMTP services of the most famous mailing platform to get a fast system to send mail using PHP.
It's really simple to set up a code with this class, starting from an HTML form :
<!DOCTYPE html>
<html>
<body>
<form method="post">
<input type="email" name="from" placeholder="From">
<input type="email" name="to" placeholder="To">
<input type="text" name="subject" placeholder="Subject">
<textearea name="content"></textarea>
</form>
</body>
</html>
<?php
require_once('PHPMailer_5.2.4\class.phpmailer.php');
if(isset($_POST["submit"])){
$username = 'YOUR_GMAIL_ACCOUNT';
$password = 'YOUR_ACCOUNT_PASSWORD';
$mail = new PHPMailer();
$mail->IsSMTP();
$mail->SMTPDebug = 1;
$mail->SMTPAuth = true;
$mail->SMTPSecure = 'ssl';
$mail->Host = "smtp.gmail.com";
$mail->Port = 465;
//$mail->addAttachment($_FILES["image"]["name"]);
$mail->IsHTML(true);
$mail->Username = $username;
$mail->Password = $password;
$mail->SetFrom($_POST["from"]);
$mail->Subject = $_POST["subject"];
$mail->Body = $_POST["content"];
$mail->AddAddress($to);
if(!$mail->Send())
{
echo "Mailer error : " . $mail->ErrorInfo . "<br>";
}
}
?>
As you can see in the PHP code, I'm using Gmail SMTP service to send this mail. Note that if you want to use other services you have to change the SMTP server.Furthermore, you need to login into your email service to get an access to the SMTP service, and you need really often to enable the possibility of accessing your mailing account by third part applications too.
In some cases, the SMTP server won't accept TLS or SSL encryption.
Is it possible to add attachment adding enctype="multipart/data" attribute to your form tag and getting the uploaded file through the $_FILES array.
I hope this is going to help you!
In your code parameters of second mail function are not completed you didn't define value of subject2 I think your first message send in the right way but the second will not

php email sending not working [duplicate]

This question already has answers here:
PHP mail function doesn't complete sending of e-mail
(31 answers)
Closed 7 years ago.
This is my php code to send email. I got the massage 'Message was sent, you can send another one' But email is not sending.
<h4>Please fill out the following form and we will be in touch with you soon.</h4>
<form action="mytest.php" method="post" id="contactform">
<ol>
<li>
<label for="name">Your Name <span class="red">*</span></label>
<input id="name" name="name" class="text" />
</li>
<li>
<label for="email">Your email <span class="red">*</span></label>
<input id="email" name="email" class="text" />
</li>
<li>
<label for="subject">Subject</label>
<input id="subject" name="subject" class="text" />
</li>
<li>
<label for="message">Message <span class="red">*</span></label>
<textarea id="message" name="message" rows="6" cols="50"></textarea>
</li>
<li class="buttons">
<input type="image" name="imageField" id="imageField" src="images/send.gif" class="send" />
<div class="clr"></div>
</li>
</ol>
</form>
<?php
if(!$_POST) exit;
$email = $_POST['email'];
$errors=0;
if($errors==1) echo $error;
else{
$email_from = $_POST['email'];
$email_from = "from#gmail.com";
$headers = "From: " . strip_tags( $_POST['name'] ) . "\r\n";
$mail_to_send_to = "to#gmail.com";
$your_feedbackmail = "from#gmail.com";
$sendflag = 'send';
if ( $sendflag == "send" )
{
$email = $_REQUEST['email'] ;
$message = $_REQUEST['message'] ;
$headers = "From: $your_feedbackmail" . "\r\n" . "Reply-To: $email" . "\r\n" ;
$a = mail( $mail_to_send_to, "Feedback Form Results", $message, $headers );
if ($a)
{
print("Message was sent, you can send another one");
} else {
print("Message wasn't sent, please check that you have changed emails in the bottom");
}
}
}
?>
I'm Using Cpanel to host my web site. Is there any special configurations to do this? I'm new to php. Please help me.
mail function doesn't provide authentication functionality. Your have to use Mail class from Mail Pear package. See here for an example:
example
I am assuming you are on shared hosting based on the fact that you are using Cpanel, some shared hosting solutions don't play nicely with php's mail() function, I have found that using phpmailer https://github.com/PHPMailer/PHPMailer works better and provides more functionality
to use phpmailer :
download from the link, place the files in your a folder accessible to your web application.
code :
$email_from = $_POST['email'];
$email_from = "from#gmail.com"; // this overwrites the $_POST['email'] value, check this
$email_from_name = "Nishanthi";
$gmailUsername = "from#gmail.com";
$gmailPassword = "mysecretpassword";
$mail_to_send_to = "to#gmail.com";
$your_feedbackmail = "from#gmail.com";
$emailSubject = "Place Subject Here";
$emailContent = "This message can contain <b>HTML</b>";
require '[path_to_your_phpmailer_files]/PHPMailerAutoload.php';
$mail = new PHPMailer;
//$mail->SMTPDebug = 3; // Enable verbose debug output
$mail->isSMTP(); // Set mailer to use SMTP
// 0 = off (for production use)
// 1 = client messages
// 2 = client and server messages
$mail->SMTPDebug = 2; //Enable SMTP debugging
$mail->Debugoutput = 'html'; //Ask for HTML-friendly debug output
$mail->Host = 'smtp.gmail.com'; // Specify main and backup SMTP servers
$mail->SMTPAuth = true; // Enable SMTP authentication
$mail->Username = $gmailUsername; // SMTP username
$mail->Password = $gmailPassword; // SMTP password
$mail->SMTPSecure = 'tls'; // Enable TLS encryption, `ssl` also accepted
$mail->Port = 587; // TCP port to connect to
$mail->setFrom($email_from, $email_from_name);
$mail->addAddress($mail_to_send_to);
$mail->addReplyTo($your_feedbackmail);
$mail->isHTML(true); // Set email format to HTML
$mail->Subject = $emailSubject;
$mail->Body = $emailContent;
if(!$mail->send()) {
echo 'Message could not be sent.';
echo 'Mailer Error: ' . $mail->ErrorInfo;
} else {
echo 'Message was sent, you can send another one';
}
?>

php script not working when sending from an external domain? [duplicate]

This question already has answers here:
PHP mail function doesn't complete sending of e-mail
(31 answers)
Closed 7 years ago.
I'm trying to run a php script on a website contact form. It's probably worth mentioning it's from a website template I bought and I have designed the website using this. My html/css/php knowledge is 'absolute beginner level' hence why I am on here...
Below is the php script (this came with the template). However it's not sending email through to the recipient email address. I've been told it's because the script is trying to send email from an external domain (ie the email address of the website visitor) through the domainname.co.uk mail server, and it’s going to reject it - how can I edit this script so that it works?
This is the PHP script:
<?php
session_start();
$email_to = 'enquiries#bonnelhomes.co.uk'; // change with your email
$name = $_POST['name'];
$email = $_POST['email'];
$subject = $_POST['subject'];
$message = $_POST['message'];
$headers = "From: $email\r\n";
$headers .= "Reply-To: $email\r\n";
if(mail($email_to, $subject, $message, $headers)){
echo "success";
}
else{
echo "failed";
}
This is the html for the contact form:
<form id="contact" class="row" name="form1" method="post" action="send.php" >
<div class="span4">
<label>Name</label>
<input type="text" class="full" name="name" id="name" />
</div>
<div class="span4">
<label>Email <span class="req">*</span></label>
<input type="text" class="full" name="email" id="email" />
<div id="error_email" class="error">Please check your email</div>
</div>
<div class="span8">
<label>Message <span class="req">*</span></label>
<textarea cols="10" rows="10" name="message" id="message" class="full"></textarea>
<div id="error_message" class="error">Please check your message</div>
<div id="mail_success" class="success">Thank you. Your message has been sent.</div>
<div id="mail_failed" class="error">Error, email not sent</div>
<p id="btnsubmit">
<input type="submit" id="send" value="Send" class="btn btn-large" />
</p>
</div>
</form>
Any help would be much appreciated. Many thanks in advance :o)
replace
$headers = "From: $email\r\n";
$headers .= "Reply-To: $email\r\n";
with
$headers = "From: mail#yourdomain.com\r\n";
UPDATE
since it is a contact form don't forget to add your user's details to $message
$message = $name. "<br>" .$email. "<br>" .$message;
security tip, on this line:
$email_to = 'enquiries#bonnelhomes.co.uk';
has security problem. An attacker can modify the headers, message and use your server to send unlimited spam messages to victims.
so add this line for more security:
if (strlen($email_to) > 30 || $email_to !== 'enquiries#bonnelhomes.co.uk') {
exit("Bye Hacker!");
}
If you still have problems sending "from your server" you might let some real email-server do the work. There is some Framework you can use which is called PHP-Mailer.
To use it, you have to download the framework and to place it into your server. Using this, you might wanna use SMTP (login-information from some real email-account).
it would look like:
require './PHPMailer/PHPMailerAutoload.php';
$mailer = new PHPMailer;
here you configure your email account to send the emails from. look on your hosters help-files to find out what you need to use to log in successfully:
$mailer->isSMTP();
$mailer->SMTPAuth = true;
$mailer->Host = 'smtp.strato.de';
$mailer->Username = 'your#sendingaccount.de';
$mailer->Password = 'xxxxxxx';
$mailer->SMTPSecure = 'ssl';
$mailer->Port = 465;
$mailer->From = 'your#sendingaccount.de';
$mailer->FromName = 'Mr Tester';
here you configure your actual email, you want to send:
$mailer->addAddress('enquiries#bonnelhomes.co.uk','Mr Admin');
$mailer->Subject = 'this is a contactform email';
$mailer->AltBody = 'your text with bla and request');
if($mailer->send()){
echo 'yeah man!';
}else{
echo 'some error occured';
}
Normally this is not absolutly necessary but it helps on servers with sendingproblems or if your emails get blockt by spam blockers.

Categories