How to send email after I input form? [duplicate] - php

This question already has answers here:
How can I send an email using PHP?
(20 answers)
Closed 5 years ago.
How to email them after they fill out the form I created, for example
<form class="form-horizontal" action="" method="post">
<div class="form-group">
<input type="text" class="form-control"
id="" value="" name="" placeholder="Name">
</div>
<div class="form-group">
<input type="email" class="form-control"
id="" value=""
placeholder="Email">
</div>
<div class="form-group">
<textarea class="form-control" rows="3" placeholder=""
Required autofocus></textarea>
</div>
<div class="form-group">
<input type="submit" name="submit" class="btn btn-info
btn-block" value="submit">
</div>
</form>
For example, I input this form. After that I can directly email from admin.
And i check my email, i get email "thank you already input".
thanks.

You can use PHPMailer class at https://github.com/PHPMailer/PHPMailer . It allows you to use the mail function or use an smtp server transparently. It also handles HTML based emails and attachments so you don't have to write your own implementation.
Here is an example from the page above:
<?php
require 'PHPMailerAutoload.php';
$mail = new PHPMailer;
$mail->isSMTP(); // Set mailer to use SMTP
$mail->Host = 'smtp1.example.com;smtp2.example.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 encryption, 'ssl' also accepted
$mail->From = 'from#example.com';
$mail->FromName = 'Mailer';
$mail->addAddress('joe#example.net', 'Joe User'); // Add a recipient
$mail->addAddress('ellen#example.com'); // Name is optional
$mail->addReplyTo('info#example.com', 'Information');
$mail->addCC('cc#example.com');
$mail->addBCC('bcc#example.com');
$mail->WordWrap = 50; // Set word wrap to 50 characters
$mail->addAttachment('/var/tmp/file.tar.gz'); // Add attachments
$mail->addAttachment('/tmp/image.jpg', 'new.jpg'); // Optional name
$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>';
$mail->AltBody = 'This is the body in plain text for non-HTML mail clients';
if(!$mail->send()) {
echo 'Message could not be sent.';
echo 'Mailer Error: ' . $mail->ErrorInfo;
} else {
echo 'Message has been sent';
}

I suggest u use PHP MAILER.
Create a Gmail account and set password application (tutorial)
Use your Gmail u create before use PHP MAILER, remember use password application
You can see example code here

Related

Form Submit displaying blank page with php file in the URL

I can't seem to find the solution for this or an answer online.
It is using Bootstrap and PHPmailer.
Below is my HTML for the form:
<div class="row">
<div class="col-md-8 col-md-offset-2">
<div class="row">
<form name="coming-soon-form" role="form" autocomplete="off" class="m-t-15" id="coming-soon-form" action="_lib/coming-soon-form.php" method="post">
<div class="row">
<div class="col-sm-6">
<div class="form-group form-group-default required">
<label class="control-label">First name</label>
<input type="text" id="name" name="name" class="form-control" required>
</div>
</div>
<div class="col-sm-6">
<div class="form-group form-group-default">
<label class="control-label">Last name</label>
<input type="text" id="last-name" name="last-name" class="form-control" required>
</div>
</div>
</div>
<div class="form-group form-group-default">
<label class="control-label">Email</label>
<input type="email" id="email" name="email" placeholder="abc#123.com" class="form-control" required>
</div>
<div class="sm-p-t-10 clearfix">
<input type="submit" class="btn btn-complete font-montserrat all-caps fs-12 pull-right xs-pull-left" value="Submit">
</div>
<div class="clearfix"></div>
</form>
</div>
</div>
</div>
and here is the php script in the "coming-soon-form.php" file:
<?php
require 'phpmailer/PHPMailerAutoload.php';
// CONFIG YOUR FIELDS
//============================================================
$name = filter_var($_POST["name"], FILTER_SANITIZE_STRING);
$email = filter_var($_POST["email"], FILTER_SANITIZE_EMAIL);
// CONFIG YOUR EMAIL MESSAGE
//============================================================
$message = '<p>The following request was sent from: </p>';
$message .= '<p>Name: ' . $name . '</p>';
$message .= '<p>Email: ' . $email . '</p>';
$message .= '<p>Message: ' . $formMessage .'</p>';
// CONFIG YOUR MAIL SERVER
//============================================================
$mail = new PHPMailer;
$mail->isSMTP(); // Enable SMTP authentication
$mail->SMTPAuth = true; // Set mailer to use SMTP
//Sign up with MAIL GUN
$mail->Host = 'smtp.gmail.com'; // Specify main and backup server (this is a fake name for the use of this example)
$mail->Username = 'email#gmail.com'; // SMTP username
$mail->Password = 'password'; // SMTP password
$mail->SMTPSecure = 'tls'; // Enable encryption, 'ssl' also accepted
$mail->Port = 587;
$mail->From = $email;
$mail->FromName = $name;
$mail->AddReplyTo($email,$name);
$mail->to('email#gmail.com');
$mail->addAddress('email#gmail.com'); // Add a recipient
$mail->WordWrap = 50; // Set word wrap to 50 characters
$mail->isHTML(true); // Set email format to HTML
$mail->Subject = 'Contact request';
$mail->Body = $message;
$mail->AltBody = 'This is the body in plain text for non-HTML mail clients';
if(!$mail->send()) {
$data['error']['title'] = 'Message could not be sent.';
$data['error']['details'] = 'Mailer Error: ' . $mail->ErrorInfo;
exit;
}
$data['success']['title'] = 'Message has been sent';
echo json_encode($data);
?>
I also have validation through jquery-validation which works fine.
However, once the form is filled out and submitted, it doesn't properly execute, send an email, or display any error or success message on the page as it should. Instead, it simply loads a blank page and the URL is www.domainnamehere.com/_lib/coming-soon-form.php
I also validated all the php using a validator.
What is causing the form submit issue???
Below is the error log information:
[23-Aug-2017 03:25:02 UTC] PHP Warning: Version warning: Imagick was compiled against Image Magick version 1650 but version 1654 is loaded. Imagick will run but may behave surprisingly in Unknown on line 0 [23-Aug-2017 03:25:02 UTC] PHP Fatal error: Uncaught Error: Call to undefined method PHPMailer::to() in /home4/anabasi2/public_html/_lib/coming-soon-form.php:34 Stack trace: #0 {main} thrown in /home4/anabasi2/public_html/_lib/coming-soon-form.php on line 34
The following line is not a valid PHPMailer method:
$mail->to('email#gmail.com');
The line below is the correct way to add a recipient.
$mail->addAddress('email#gmail.com');
This is the correct way to send email with the PHPMailer :
$mail = new PHPMailer;
//$mail->SMTPDebug = 3; // Enable verbose debug output
$mail->isSMTP(); // Set mailer to use SMTP
$mail->Host = 'smtp1.example.com;smtp2.example.com';
$mail->SMTPAuth = true;
$mail->Username = 'user#example.com'; // SMTP username
$mail->Password = 'secret'; // SMTP password
$mail->SMTPSecure = 'tls';
$mail->Port = 587;
$mail->setFrom('from#example.com', 'Mailer');
$mail->addAddress('joe#example.net', 'Joe User'); // Add a recipient
$mail->addAddress('ellen#example.com'); // Name is optional
$mail->addReplyTo('info#example.com', 'Information');
$mail->addCC('cc#example.com');
$mail->addBCC('bcc#example.com');
$mail->addAttachment('/var/tmp/file.tar.gz'); // Add attachments
$mail->addAttachment('/tmp/image.jpg', 'new.jpg'); // Optional name
$mail->isHTML(true);
$mail->Subject = 'Here is the subject';
$mail->Body = 'This is the HTML message body <b>in bold!</b>';
$mail->AltBody = 'This is the body in plain text for non-HTML mail clients';
if(!$mail->send()) {
echo 'Message could not be sent.';
echo 'Mailer Error: ' . $mail->ErrorInfo;
} else {
echo 'Message has been sent';
}
please consider about your usage of $mail->From and $mail->To method .

php form - godaddy economic hosting Linux

i have this form:
<form action="/sendemail.php" id="main-contact-form" method="post" name="contact-form" role="form">
<div class="form-group">
<input class="form-control" id="name" name="name" placeholder="put your name" required="" type="text" />
</div>
<div class="form-group">
<input class="form-control" id="email" name="email" placeholder="Email" required="" type="email" />
</div>
<div class="form-group">
<input class="form-control" id="subject" name="subject" placeholder="Subject..." required="" type="text" />
</div>
<div class="form-group">
<textarea class="form-control" name="message" placeholder="Mensaje" required="" rows="8"></textarea>
</div>
<input class="btn btn-primary" id="submit" name="submit" type="submit" value="Enviar" />
and this is sendemail.php:
<?php
$pos = $_POST;
$name = $_POST['name'];
$email = $_POST['email'];
$message = $_POST['message'];
$from = $_POST['email'];
$to = 'email#gmail.com ';
$subject = 'contact message ';
$body = "From: $name\n E-Mail: $email\n Message:\n $message\n $pos";
mail ($to, $subject, $body, $from)
?>
the email is arrive empty, i try a lot of stuffs but always comes in the same way, is like the form canĀ“t pass the data from inputs to php variables. im new in php so, any help is welcome.
thanks.
The use of mail() function is so insecure and is a vector attack to send massive spam, don't use anymore, for this reason is better to use PHP Mailer libray.
Create a EMAIL account (example: no-reply#domain.com) in your hosting and after that install this library PHP Mailer, now you can do this:
<?php
require 'PHPMailerAutoload.php';
$mail = new PHPMailer;
//$mail->SMTPDebug = 3; // Enable verbose debug output
$mail->isSMTP(); // Set mailer to use SMTP
$mail->Host = 'smtp1.example.com;smtp2.example.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->setFrom('from#example.com', 'Mailer');
$mail->addAddress('joe#example.net', 'Joe User'); // Add a recipient
$mail->addAddress('ellen#example.com'); // Name is optional
$mail->addReplyTo('info#example.com', 'Information');
$mail->addCC('cc#example.com');
$mail->addBCC('bcc#example.com');
$mail->addAttachment('/var/tmp/file.tar.gz'); // Add attachments
$mail->addAttachment('/tmp/image.jpg', 'new.jpg'); // Optional name
$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>';
$mail->AltBody = 'This is the body in plain text for non-HTML mail clients';
if(!$mail->send()) {
echo 'Message could not be sent.';
echo 'Mailer Error: ' . $mail->ErrorInfo;
} else {
echo 'Message has been sent';
}
UPDATE
After some research I've found that:
You need to ask godaddy technical support to enable "sendmail".
PHP mail() not working on GoDaddy
----------
I've tested your code and it works. I've received the email with ALL the $_POST contents without any problems.
$pos = $_POST;
$name = $_POST['name'];
$email = $_POST['email'];
$message = $_POST['message'];
$from = $_POST['email'];
$to = 'email#gmail.com ';
$subject = 'contact message ';
NOTE:
1 - $pos = $_POST; is an array and it will be displayed as Array.
2 - Emails sent via mail() will most likely end-up on the spam folder (read the comments below).

PHP Mailer is giving me error 404

Here is my html for my form, action and everything else should be correct, I'm thinking its probably my php?
<form class="form-inline" role="form" method="post" action="index.php">
<div class="form-group">
<label for="inputName">Name</label>
<input type="text" class="form-control" id="inputName" placeholder="Jane Doe">
</div>
<div class="form-group">
<label for="inputEmail">Email</label>
<input type="email" class="form-control" id="inputEmail" placeholder="jane.doe#example.com">
<button type="submit" class="btn btn-default" id="formBtn">Send Email</button>
</div>
</form>
Here is my PHP that I copied and then changed the details to fit myself from github.
<?php
require 'phpMailer/PHPMailerAutoload.php';
$mail = new PHPMailer;
$mail->SMTPDebug = 3;
$mail->isSMTP(); // Set mailer to use SMTP
$mail->Host = 'smtp.gmail.com'; // Specify main and backup SMTP servers
$mail->SMTPAuth = true; // Enable SMTP authentication
$mail->Username = 'email#gmail.com'; // SMTP username
$mail->Password = 'password'; // SMTP password
$mail->SMTPSecure = 'ssl'; // Enable TLS encryption, `ssl` also accepted
$mail->Port = 465; // TCP port to connect to
$mail->From = 'email#gmail.com';
$mail->FromName = 'Bradley';
$mail->addAddress('email#gmail.com', 'Brad'); // Add a recipient
$mail->addReplyTo('email#gmail.com', 'Reply address');
$mail->addAttachment('/var/tmp/file.tar.gz'); // Add attachments
$mail->addAttachment('/tmp/image.jpg', 'new.jpg'); // Optional name
$mail->isHTML(true); // Set email format to HTML
$mail->Subject = 'Email from Vote Unanimous';
$mail->Body = 'You have a new email from your Vote Unanimous account. You should have a name and new email';
$mail->AltBody = 'You have a new email from your Vote Unanimous account. You should have a name and new email';
if(!$mail->send()) {
echo 'Message could not be sent.';
echo 'Mailer Error: ' . $mail->ErrorInfo;
} else {
echo 'Message has been sent';
}
Thanks for helping out. I had to change my password in my gmail account to make it work

PhpMailer - Is sending message but not pulling the form data [duplicate]

This question already has answers here:
What is the difference between single-quoted and double-quoted strings in PHP?
(7 answers)
Closed 7 years ago.
I have tried to make a simple PHP contact form, but it turned out that I needed to use SMTP and PHPMailer because it's hosted on a windows server.
I have set up a contact form using the example document on the PHPMailer website. I am having trouble pulling the data from my form. The email does send but in the body it shows up as:
> Name: $name
>
> Email: $email
>
> Message: $comment
I know there are lots of questions about this on here Stackoverflow, but I can't seem to figure it out.
PHP
<?php
require 'PHPMailer/PHPMailerAutoload.php';
$name = $_REQUEST['name'];
$email = $_REQUEST['email'];
$comment = $_REQUEST['comment'];
$mail = new PHPMailer;
$mail->SMTPDebug = 2; // Enable verbose debug output
$mail->isSMTP(); // Set mailer to use SMTP
$mail->Host = 'mail.example.co.uk'; // Specify main and backup SMTP servers
$mail->SMTPAuth = false; // Enable SMTP authentication
$mail->Username = 'test#example.co.uk'; // SMTP username
$mail->Password = 'password'; // SMTP password
$mail->SMTPSecure = 'tls'; // Enable TLS encryption, `ssl` also accepted
$mail->Port = 25; // TCP port to connect to
$mail->From = 'test#example.co.uk';
$mail->FromName = 'Mailer';
$mail->addAddress('test#example.co.uk', 'Bob'); // Add a recipient
//$mail->addAddress('ellen#example.com'); // Name is optional
//$mail->addReplyTo('info#example.com', 'Information');
//$mail->addCC('cc#example.com');
//$mail->addBCC('bcc#example.com');
//$mail->addAttachment('/var/tmp/file.tar.gz'); // Add attachments
//$mail->addAttachment('/tmp/image.jpg', 'new.jpg'); // Optional name
$mail->isHTML(true); // Set email format to HTML
$mail->Subject = 'Here is the subject';
$mail->Body = '<p><strong>Name:</strong> $name</p>
<p><strong>Email:</strong> $email</p>
<p><strong>Message:</strong> $comment</p>';
$mail->AltBody = 'This is the body in plain text for non-HTML mail clients';
if(!$mail->send()) {
echo 'Message could not be sent.';
echo 'Mailer Error: ' . $mail->ErrorInfo;
} else {
echo 'Message has been sent';
}
?>
HTML
<form role="form" method="post" action="mail.php">
<p><label for="name">Name</label></p>
<p><input type="text" id="name" name="name" placeholder="First & Last Name" value=""></p>
<p><label for="subject" >Subject</label></p>
<p><input type="text" id="subject" name="subject" placeholder="Subject" value=""></p>
<p><label for="email" >Email</label></p>
<p><input type="email" id="email" name="email" placeholder="example#domain.com" value=""></p>
<p><label for="comment">Message</label></p>
<p><textarea rows="4" id="comment" name="comment"></textarea></p>
<p><input id="submit" name="submit" type="submit" value="Send"></p>
</form>
Your code for $mail->body is:
$mail->Body = '<p><strong>Name:</strong> $name</p>
<p><strong>Email:</strong> $email</p>
<p><strong>Message:</strong> $comment</p>';
$mail->AltBody = 'This is the body in plain text for non-HTML mail clients';
Just replace with below code :
$mail->Body = '<p><strong>Name: </strong>'.$name.'</p>
<p><strong>Email: </strong>'.$email.'</p>
<p><strong>Message: </strong>'.$comment.'</p>';
$mail->AltBody = ' This is the body in plain text for non-HTML mail clients';

Very simple PHPmailer Not Working

I'm trying to use PHPmailer for the first time and even with a simple set up I am having trouble getting the email to go through. I am using the simple default php mail() function that phpmailer uses, I've used mail() with arguments before on other forms and those emails went through but on this particular site I want to have attachements sent as well. Here is my code so far, note that the attachments, name, email, or checkbox have not been pulled and added to the php code, I'm just getting the darn to work and send whatever is in the textarea. Please help!!!
--HTML-----------------------------------------
<form role="form" action="_/includes/sendmail.php" enctype="multipart/form-data" method="POST" autocomplete="on">
<div class="form-group">
<label class="emph1">First and Last Name:</label>
<input type="text" class="form-control" id="exampleInputEmail1" placeholder="First and Last Name">
</div>
<div class="form-group">
<label class="emph1">Email Address:</label>
<input type="email" class="form-control" id="exampleInputPassword1" placeholder="Email">
</div>
<div class="form-group">
<label class="emph1">File/Form Attachments:</label>
<?php
//Maximum file size (in bytes) must be declared before the file input field and can't be large than the setting for
// upload_max_filesize in php.ini.
// PHP will stop and compain once file is exceeded
// 1 mb is actually 1,048,576 bytes.
?>
<input type="hidden" name="MAX_FILE_SIZE" value="5000000" />
<input type="file" id="exampleInputFile" name="file_upload">
<p class="help-block">Please use .jpg, .pdf, or Word based files.</p>
<p> <?php echo $message;?>
</div>
<div class="form-group">
<label class="emph1">Reason for contacting Derek Davis, PLLC:</label>
<div class="checkbox">
<label>Estate Planning<input type="checkbox"></label>
</div>
<div class="checkbox">
<label>Family Law<input type="checkbox"></label>
</div>
<div class="checkbox">
<label>Criminal Defense<input type="checkbox"></label>
</div>
<div class="checkbox">
<label>Collections<input type="checkbox"></label>
</div>
<div class="checkbox">
<label>Landlord-Tenant<input type="checkbox"></label>
</div>
<div class="checkbox">
<label>Other<input id="checkbox-other" type="checkbox"></label>
</div>
<!-- jQuery input feature (displays when "other" checkbox is checked) --->
<div class="form-group" id="input-other" style="display:none;">
<label class="emph1" for="">If 'other' please specify:</label>
<input type="text" class="form-control" id="otherProject" name="otherProject" placeholder="Enter short description here." value="" />
</div>
</div>
<!-- End jQuery input feature -->
<div class="form-group">
<label class="emph1">Please leave us a brief message:</label>
<textarea class="full-width" type="text" name="message" rows="10" placeholder="Please be as specific as possible..." required>
</textarea><br />
</div>
<button type="submit" class="btn btn-default">Submit</button>
</form>
--PHPmailer---------------------------
<?php
require_once("_/includes/phpmailer/class.smtp.php");
require_once("_/includes/phpmailer/class.phpmailer.php");
if (isset($_POST['message'])){
$body = $_POST['message'];
}
// Set PHPMailer to use the sendmail transport
//Set who the message is to be sent from
$mail->setFrom('myemail#gmail.com', 'First Last');
//Set an alternative reply-to address
$mail->addReplyTo('myemail#gmail.com', 'First Last');
//Set the subject line
$mail->addAddress('myotheremail#yahoo.com', 'John Doe');
$mail->Subject = 'PHPMailer sendmail test';
//Replace the plain text body with one created manually
$mail->Body = $body;
$mail->AltBody = 'This is a plain-text message body';
//Attach an image file
//$mail->addAttachment($temp_file, $temp_file_name);
//send the message, check for errors
$mail-Send();
?>
Thanks for the quick responses!! I made the changes to send() and initiated the class but it still didn't send crap to my yahoo.com email address. Heres the code now....
<?php
require_once("_/includes/phpmailer/class.smtp.php");
require_once("_/includes/phpmailer/class.phpmailer.php");
$mail = new PHPMailer;
if (isset($_POST['message'])){
$body = $_POST['message'];
}
// Set PHPMailer to use the sendmail transport
//Set who the message is to be sent from
$mail->setFrom('myemail#gmail.com', 'First Last');
//Set an alternative reply-to address
$mail->addReplyTo('myemail#gmail.com', 'First Last');
//Set the subject line
$mail->addAddress('myotheremail#yahoo.com', 'John Doe');
$mail->Subject = 'PHPMailer sendmail test';
//Replace the plain text body with one created manually
$mail->Body = $body;
$mail->AltBody = 'This is a plain-text message body';
//Attach an image file
//$mail->addAttachment($temp_file, $temp_file_name);
//send the message, check for errors
$mail->send();
?>
UPDATE!!!
Ok so here my code now. Not only does it not send a message to my email but it also doesn't redirect me to either page... Any suggestions?
<?php ob_start()?>
<?php
require_once("_/includes/phpmailer/class.smtp.php");
require_once("_/includes/phpmailer/class.phpmailer.php");
$mail = new PHPMailer();
if (isset($_POST['message'])){
$body = $_POST['message'];
}
// Set PHPMailer to use the sendmail transport
//Set who the message is to be sent from
$mail->setFrom('myemail#gmail.com', 'First Last');
//Set an alternative reply-to address
$mail->addReplyTo('myemail#gmail.com', 'First Last');
//Set the subject line
$mail->addAddress('myotheremail#yahoo.com', 'John Doe');
$mail->Subject = 'PHPMailer sendmail test';
//Replace the plain text body with one created manually
$mail->Body = $body;
$mail->AltBody = 'This is a plain-text message body';
//Attach an image file
//$mail->addAttachment($temp_file, $temp_file_name);
//send the message, check for errors
if ($mail->send()) {
redirect_to("../../contact.php");
} else {
redirect_to("../../index.html");
}
?>
<?php ob_end_flush(); ?>
It looks like you never initialized $mail. Add the following line before any of your $mail-> methods. See the example in their documentation.
$mail = new PHPMailer;
To learn more about class constructors, check the PHP documentation.
And you have a typo: $mail-Send(); should be $mail->Send();
Looks like a typo here:
$mail->Send();
//send the message, check for errors
$mail-Send();
should be $mail->send(); ?
As you are using SMTP. The correct way to use smtp is like this
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');
$body = eregi_replace("[\]",'',$body);
$mail->IsSMTP(); // telling the class to use SMTP
$mail->SMTPDebug = 2; // enables SMTP debug information (for testing)
// 1 = errors and messages
// 2 = messages only
$mail->SMTPAuth = true; // enable SMTP authentication
$mail->SMTPSecure = "tls"; // sets the prefix to the servier
$mail->Host = "smtp.gmail.com"; // sets GMAIL as the SMTP server
$mail->Port = 587; // set the SMTP port for the GMAIL server
$mail->Username = "yourusername#gmail.com"; // GMAIL username
$mail->Password = "yourpassword"; // GMAIL password
$mail->SetFrom('name#yourdomain.com', 'First Last');
$mail->AddReplyTo("name#yourdomain.com","First Last");
$mail->Subject = "PHPMailer Test Subject via smtp (Gmail), basic";
$mail->AltBody = "To view the message, please use an HTML compatible email viewer!"; // optional, comment out and test
$mail->MsgHTML($body);
$address = "whoto#otherdomain.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!";
}

Categories