Prince Joal
Web Developer
  • Name: Prince

  • Birthday: 28 February 1993

  • Job: Freelancer

  • Email: i@princejoal.com

  • Skype: 1081a1d198d8081c

Ballon Games

A website is incomplete without mail functionality Both static and dynamic websites require it. As contact form or other way like  feedback form or many way you can use it  , So today I will tell you how you can send email from website in easy way.

index.php


use PHPMailer\PHPMailer\PHPMailer;
use PHPMailer\PHPMailer\SMTP;
use PHPMailer\PHPMailer\Exception; // Load Composer's autoloader require 'vendor/autoload.php'; $mail = new PHPMailer(true);

Need to configure

$mail->Host = 'smtp.gmail.com'; // Specify main and backup SMTP servers
$mail->SMTPAuth = true; // Enable SMTP authentication
$mail->Username = 'mail@gmail.com'; // your email id
$mail->Password = '#########'; // your password
$mail->SMTPSecure = 'tls';
$mail->Port = 587; //587 is used for Outgoing Mail (SMTP) Server.
$mail->setFrom('mail@gmail.com', 'Prince Joal');
$mail->addAddress('i@princejoal.com'); // Add a recipient
$mail->isHTML(true); // Set email format to HTML

$bodyContent = '<h1>HeY!,</h1>';
$bodyContent .= '<p>This is a email that Prince joal send you From LocalHost using PHPMailer</p>';
$mail->Subject = 'Email from PrinceJoal Web';
Tags: Php, Technology