SlideShare a Scribd company logo
1 of 4
Download to read offline
TO CONFIGURE RUNTIME PHP AND EMAIL SERVICE
<?php
//Follow the below steps
//login into your gmail then copy paste this url
//https://www.google.com/settings/security/lesssecureapps
// enable it.
require 'PHPMailer/PHPMailerAutoload.php';
if(isset($_POST['submit'])){
$mail = new PHPMailer;
$name = $_POST['name'];
$femail = $_POST['femail'];
$toemail = $_POST['email'];
$pass = $_POST['pwd'];
//$bccemail = $_POST['bccemail'];
$subject = $_POST['subject'];
$bodycontent = $_POST['message'];
$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 = 'loganyavairam@gmail.com'; // SMTP username
$mail->Password = 'vrslfamily'; // SMTP password
$mail->SMTPSecure = 'tls'; // Enable TLS encryption, `ssl` also accepted
$mail->Port = 587; // TCP port to connect to
$mail->setFrom($femail, $name);
$mail->addReplyTo($femail, $name);
$mail->addAddress($toemail); // Add a recipient
$mail->isHTML(true); // Set email format to HTML
$mail->Subject = $subject;
$mail->Body = $bodycontent;
$mail->AddAttachment($_FILES['image']['tmp_name'], $_FILES['image']['name']);
if(!$mail->send()) {
echo 'Message could not be sent.';
echo '<font color = "Black">Mailer Error: ' . $mail->ErrorInfo.'</font>';
} else {
echo '<font color = "Blue">Message has been sent</font>';
}
}
?>
<html>
<body>
<form action="" method="POST" enctype='multipart/form-data'>
<table>
<tr>
<td> Name : </td>
<td><input type="text" id="name" name="name" placeholder='User Name'/>
<div id="invalid-name"></div></td></tr>
<tr>
<td> From E-mail: </td>
<td><input type="email" id="femail" name="femail" placeholder='From E-mail'/>
<div id="invalid-name"></div>
</td><tr>
<td> To E-mail : </td>
<td><input type="email" id="email" name="email" placeholder='E-Mail'/>
<div id="invalid-email"></div>
</td></tr>
<td> Subject : </td>
<td><input type="text" id="subject" name="subject" placeholder='Subject'/>
<div id="invalid-femail"></div>
</td>
</tr>
<tr>
<td> Image : </td>
<td><input type="file" id="image" name="image" placeholder='Image' accept="image/*"> <div
id="invalid-image"></div></td>
</tr>
<tr>
<td> Message : </td>
<td><textarea cols="27" rows="5" id="message" name="message" placeholder='Message'
value=''></textarea><div id="invalid-message"></td>
</tr>
<tr>
<td colspan="2"> <input type="submit" value="Send Mail!" id='submit_btn'
name="submit"/></td>
</tr>
<table>
</form>
</body>
</html>
OUTPUT:
Php mail program

More Related Content

What's hot

Saferpay Checkout Page - PHP Sample (Hosting)
Saferpay Checkout Page - PHP Sample (Hosting)Saferpay Checkout Page - PHP Sample (Hosting)
Saferpay Checkout Page - PHP Sample (Hosting)
webhostingguy
 

What's hot (19)

WordPress: From Antispambot to Zeroize
WordPress: From Antispambot to ZeroizeWordPress: From Antispambot to Zeroize
WordPress: From Antispambot to Zeroize
 
Practica csv
Practica csvPractica csv
Practica csv
 
M.php
M.phpM.php
M.php
 
Amp Up Your Admin
Amp Up Your AdminAmp Up Your Admin
Amp Up Your Admin
 
Mojolicious on Steroids
Mojolicious on SteroidsMojolicious on Steroids
Mojolicious on Steroids
 
Mysql connect
Mysql connectMysql connect
Mysql connect
 
5. hello popescu
5. hello popescu5. hello popescu
5. hello popescu
 
Memcache
MemcacheMemcache
Memcache
 
7 reasons why developers should love Joomla!
7 reasons why developers should love Joomla!7 reasons why developers should love Joomla!
7 reasons why developers should love Joomla!
 
Codigo principal
Codigo principalCodigo principal
Codigo principal
 
Mojolicious - Perl Framework for the Real-Time Web (Lightning Talk)
Mojolicious - Perl Framework for the Real-Time Web (Lightning Talk)Mojolicious - Perl Framework for the Real-Time Web (Lightning Talk)
Mojolicious - Perl Framework for the Real-Time Web (Lightning Talk)
 
kazumich@acmscamp2010spring
kazumich@acmscamp2010springkazumich@acmscamp2010spring
kazumich@acmscamp2010spring
 
Dress Your WordPress with Child Themes
Dress Your WordPress with Child ThemesDress Your WordPress with Child Themes
Dress Your WordPress with Child Themes
 
Building scalable products with WordPress - WordCamp London 2018
Building scalable products with WordPress - WordCamp London 2018Building scalable products with WordPress - WordCamp London 2018
Building scalable products with WordPress - WordCamp London 2018
 
Saferpay Checkout Page - PHP Sample (Hosting)
Saferpay Checkout Page - PHP Sample (Hosting)Saferpay Checkout Page - PHP Sample (Hosting)
Saferpay Checkout Page - PHP Sample (Hosting)
 
Top Wordpress dashboard hacks
Top Wordpress dashboard hacks Top Wordpress dashboard hacks
Top Wordpress dashboard hacks
 
Web 10 | PHP with MySQL
Web 10 | PHP with MySQLWeb 10 | PHP with MySQL
Web 10 | PHP with MySQL
 
Mojolicious - A new hope
Mojolicious - A new hopeMojolicious - A new hope
Mojolicious - A new hope
 
TerminalでTwitter
TerminalでTwitterTerminalでTwitter
TerminalでTwitter
 

Similar to Php mail program

Unit 3 - for php application Sessions.pptx
Unit 3  -  for php  application Sessions.pptxUnit 3  -  for php  application Sessions.pptx
Unit 3 - for php application Sessions.pptx
mythili213835
 
מ-antispambot ועד zeroise – עשר פונקציות וורדפרס שאתם כנראה לא מכירים
מ-antispambot ועד zeroise – עשר פונקציות וורדפרס שאתם כנראה לא מכיריםמ-antispambot ועד zeroise – עשר פונקציות וורדפרס שאתם כנראה לא מכירים
מ-antispambot ועד zeroise – עשר פונקציות וורדפרס שאתם כנראה לא מכירים
Miriam Schwab
 
How to Create Login and Registration API in PHP.pdf
How to Create Login and Registration API in PHP.pdfHow to Create Login and Registration API in PHP.pdf
How to Create Login and Registration API in PHP.pdf
Appweb Coders
 
Form Processing In Php
Form Processing In PhpForm Processing In Php
Form Processing In Php
Harit Kothari
 

Similar to Php mail program (20)

Unit 3 - for php application Sessions.pptx
Unit 3  -  for php  application Sessions.pptxUnit 3  -  for php  application Sessions.pptx
Unit 3 - for php application Sessions.pptx
 
Eden Hackathon Benilde (Mysql & SMTP)
Eden Hackathon Benilde (Mysql & SMTP)Eden Hackathon Benilde (Mysql & SMTP)
Eden Hackathon Benilde (Mysql & SMTP)
 
Sending E-mail that reaches the destination using PHP
Sending E-mail that reaches the destination using PHPSending E-mail that reaches the destination using PHP
Sending E-mail that reaches the destination using PHP
 
WordPress Configuration tips
WordPress Configuration tipsWordPress Configuration tips
WordPress Configuration tips
 
The Zen of Lithium
The Zen of LithiumThe Zen of Lithium
The Zen of Lithium
 
Modern Web Development with Perl
Modern Web Development with PerlModern Web Development with Perl
Modern Web Development with Perl
 
CakePHP workshop
CakePHP workshopCakePHP workshop
CakePHP workshop
 
Daily notes
Daily notesDaily notes
Daily notes
 
מ-antispambot ועד zeroise – עשר פונקציות וורדפרס שאתם כנראה לא מכירים
מ-antispambot ועד zeroise – עשר פונקציות וורדפרס שאתם כנראה לא מכיריםמ-antispambot ועד zeroise – עשר פונקציות וורדפרס שאתם כנראה לא מכירים
מ-antispambot ועד zeroise – עשר פונקציות וורדפרס שאתם כנראה לא מכירים
 
Silex Cheat Sheet
Silex Cheat SheetSilex Cheat Sheet
Silex Cheat Sheet
 
Silex Cheat Sheet
Silex Cheat SheetSilex Cheat Sheet
Silex Cheat Sheet
 
Mail server configuration
Mail server configurationMail server configuration
Mail server configuration
 
The HyperText Markup Language or HTML is the standard markup language
The HyperText Markup Language or HTML is the standard markup languageThe HyperText Markup Language or HTML is the standard markup language
The HyperText Markup Language or HTML is the standard markup language
 
WordPress REST API hacking
WordPress REST API hackingWordPress REST API hacking
WordPress REST API hacking
 
Micropage in microtime using microframework
Micropage in microtime using microframeworkMicropage in microtime using microframework
Micropage in microtime using microframework
 
How to Create Login and Registration API in PHP.pdf
How to Create Login and Registration API in PHP.pdfHow to Create Login and Registration API in PHP.pdf
How to Create Login and Registration API in PHP.pdf
 
dfhdf
dfhdfdfhdf
dfhdf
 
Form Processing In Php
Form Processing In PhpForm Processing In Php
Form Processing In Php
 
SOLID in Practice
SOLID in PracticeSOLID in Practice
SOLID in Practice
 
Crafting beautiful software
Crafting beautiful softwareCrafting beautiful software
Crafting beautiful software
 

More from pyingkodi maran (9)

Number systems
Number systemsNumber systems
Number systems
 
Signed Binary Numbers
Signed Binary NumbersSigned Binary Numbers
Signed Binary Numbers
 
Essential concepts for machine learning
Essential concepts for machine learning Essential concepts for machine learning
Essential concepts for machine learning
 
Sub Queries in oracle
Sub Queries in oracleSub Queries in oracle
Sub Queries in oracle
 
Dbms keys
Dbms keysDbms keys
Dbms keys
 
Android sensor
Android sensorAndroid sensor
Android sensor
 
Data preprocessing in Machine learning
Data preprocessing in Machine learning Data preprocessing in Machine learning
Data preprocessing in Machine learning
 
Introduction to Android Programming by Dr.M.Pyingkodi-kongu engineering c...
Introduction to  Android   Programming by  Dr.M.Pyingkodi-kongu engineering c...Introduction to  Android   Programming by  Dr.M.Pyingkodi-kongu engineering c...
Introduction to Android Programming by Dr.M.Pyingkodi-kongu engineering c...
 
Simple PHP programs by kongu Engineering College
Simple  PHP programs by  kongu  Engineering CollegeSimple  PHP programs by  kongu  Engineering College
Simple PHP programs by kongu Engineering College
 

Recently uploaded

Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in DelhiRussian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
kauryashika82
 
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Krashi Coaching
 
Beyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactBeyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global Impact
PECB
 

Recently uploaded (20)

Arihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdfArihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdf
 
Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3
 
Z Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphZ Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot Graph
 
Key note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfKey note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdf
 
General AI for Medical Educators April 2024
General AI for Medical Educators April 2024General AI for Medical Educators April 2024
General AI for Medical Educators April 2024
 
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in DelhiRussian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
 
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
 
Código Creativo y Arte de Software | Unidad 1
Código Creativo y Arte de Software | Unidad 1Código Creativo y Arte de Software | Unidad 1
Código Creativo y Arte de Software | Unidad 1
 
Grant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingGrant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy Consulting
 
Paris 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityParis 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activity
 
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
 
9548086042 for call girls in Indira Nagar with room service
9548086042  for call girls in Indira Nagar  with room service9548086042  for call girls in Indira Nagar  with room service
9548086042 for call girls in Indira Nagar with room service
 
Measures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SDMeasures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SD
 
Introduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsIntroduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The Basics
 
Beyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactBeyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global Impact
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introduction
 
Sanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfSanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdf
 
A Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformA Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy Reform
 
Student login on Anyboli platform.helpin
Student login on Anyboli platform.helpinStudent login on Anyboli platform.helpin
Student login on Anyboli platform.helpin
 
IGNOU MSCCFT and PGDCFT Exam Question Pattern: MCFT003 Counselling and Family...
IGNOU MSCCFT and PGDCFT Exam Question Pattern: MCFT003 Counselling and Family...IGNOU MSCCFT and PGDCFT Exam Question Pattern: MCFT003 Counselling and Family...
IGNOU MSCCFT and PGDCFT Exam Question Pattern: MCFT003 Counselling and Family...
 

Php mail program

  • 1. TO CONFIGURE RUNTIME PHP AND EMAIL SERVICE <?php //Follow the below steps //login into your gmail then copy paste this url //https://www.google.com/settings/security/lesssecureapps // enable it. require 'PHPMailer/PHPMailerAutoload.php'; if(isset($_POST['submit'])){ $mail = new PHPMailer; $name = $_POST['name']; $femail = $_POST['femail']; $toemail = $_POST['email']; $pass = $_POST['pwd']; //$bccemail = $_POST['bccemail']; $subject = $_POST['subject']; $bodycontent = $_POST['message']; $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 = 'loganyavairam@gmail.com'; // SMTP username $mail->Password = 'vrslfamily'; // SMTP password $mail->SMTPSecure = 'tls'; // Enable TLS encryption, `ssl` also accepted $mail->Port = 587; // TCP port to connect to $mail->setFrom($femail, $name); $mail->addReplyTo($femail, $name); $mail->addAddress($toemail); // Add a recipient $mail->isHTML(true); // Set email format to HTML $mail->Subject = $subject; $mail->Body = $bodycontent; $mail->AddAttachment($_FILES['image']['tmp_name'], $_FILES['image']['name']); if(!$mail->send()) { echo 'Message could not be sent.'; echo '<font color = "Black">Mailer Error: ' . $mail->ErrorInfo.'</font>'; } else { echo '<font color = "Blue">Message has been sent</font>'; } } ?>
  • 2. <html> <body> <form action="" method="POST" enctype='multipart/form-data'> <table> <tr> <td> Name : </td> <td><input type="text" id="name" name="name" placeholder='User Name'/> <div id="invalid-name"></div></td></tr> <tr> <td> From E-mail: </td> <td><input type="email" id="femail" name="femail" placeholder='From E-mail'/> <div id="invalid-name"></div> </td><tr> <td> To E-mail : </td> <td><input type="email" id="email" name="email" placeholder='E-Mail'/> <div id="invalid-email"></div> </td></tr> <td> Subject : </td> <td><input type="text" id="subject" name="subject" placeholder='Subject'/> <div id="invalid-femail"></div> </td> </tr> <tr> <td> Image : </td> <td><input type="file" id="image" name="image" placeholder='Image' accept="image/*"> <div id="invalid-image"></div></td> </tr> <tr> <td> Message : </td> <td><textarea cols="27" rows="5" id="message" name="message" placeholder='Message' value=''></textarea><div id="invalid-message"></td> </tr> <tr> <td colspan="2"> <input type="submit" value="Send Mail!" id='submit_btn' name="submit"/></td> </tr> <table> </form> </body> </html>