howto send email from my website using php mailer code example
Example 1: how to send email with php
<?php
var Name = $_POST('name');
var Email = $_POST('email');
var Number = $_POST('number');
$to_email = 'Your E-mail';
$subject = 'The Subject of the message';
$message = 'Name'.$name. "email" .$email. "number:" .$number.".";
$headers = 'From: noreply @ company . com';
mail($to_email,$subject,$message,$headers);
?>
Example 2: how to setup php mailer
<?php
include "emails/PHPMailer/PHPMailerAutoload.php";
$mail = new PHPMailer();
$mail->IsSMTP();
$mail->SMTPDebug = 1;
$mail->SMTPAuth = true;
$mail->SMTPSecure = 'ssl';
$mail->Host = "smtp.gmail.com";
$mail->Port = 465;
$mail->IsHTML(true);
$mail->Username = "@gmail.com";
$mail->Password = "";
$mail->setFrom('[email protected]', 'Zubair Mushtaq');
$mail->addReplyTo('[email protected]', 'Secure Developer');
$mail->addAddress('[email protected]', 'Abulogicss');
$mail->Subject = 'PHPMailer SMTP test';
$mail->msgHTML("convert HTML into a basic plain-text alternative body");
$mail->AltBody = 'This is a plain-text message body';
if (!$mail->send()) {
echo "Mailer Error: " . $mail->ErrorInfo;
} else {
echo "Message sent!";
}