SlideShare ist ein Scribd-Unternehmen logo
1 von 4
Downloaden Sie, um offline zu lesen
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

Weitere ähnliche Inhalte

Was ist angesagt?

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
 

Was ist angesagt? (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
 

Ähnlich wie 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
 

Ähnlich wie 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
 

Mehr von 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
 

Kürzlich hochgeladen

The basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxThe basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptx
heathfieldcps1
 
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
ZurliaSoop
 

Kürzlich hochgeladen (20)

Plant propagation: Sexual and Asexual propapagation.pptx
Plant propagation: Sexual and Asexual propapagation.pptxPlant propagation: Sexual and Asexual propapagation.pptx
Plant propagation: Sexual and Asexual propapagation.pptx
 
On National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan FellowsOn National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan Fellows
 
NO1 Top Black Magic Specialist In Lahore Black magic In Pakistan Kala Ilam Ex...
NO1 Top Black Magic Specialist In Lahore Black magic In Pakistan Kala Ilam Ex...NO1 Top Black Magic Specialist In Lahore Black magic In Pakistan Kala Ilam Ex...
NO1 Top Black Magic Specialist In Lahore Black magic In Pakistan Kala Ilam Ex...
 
On_Translating_a_Tamil_Poem_by_A_K_Ramanujan.pptx
On_Translating_a_Tamil_Poem_by_A_K_Ramanujan.pptxOn_Translating_a_Tamil_Poem_by_A_K_Ramanujan.pptx
On_Translating_a_Tamil_Poem_by_A_K_Ramanujan.pptx
 
How to setup Pycharm environment for Odoo 17.pptx
How to setup Pycharm environment for Odoo 17.pptxHow to setup Pycharm environment for Odoo 17.pptx
How to setup Pycharm environment for Odoo 17.pptx
 
Interdisciplinary_Insights_Data_Collection_Methods.pptx
Interdisciplinary_Insights_Data_Collection_Methods.pptxInterdisciplinary_Insights_Data_Collection_Methods.pptx
Interdisciplinary_Insights_Data_Collection_Methods.pptx
 
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptxBasic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
 
Python Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docxPython Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docx
 
Jamworks pilot and AI at Jisc (20/03/2024)
Jamworks pilot and AI at Jisc (20/03/2024)Jamworks pilot and AI at Jisc (20/03/2024)
Jamworks pilot and AI at Jisc (20/03/2024)
 
Unit 3 Emotional Intelligence and Spiritual Intelligence.pdf
Unit 3 Emotional Intelligence and Spiritual Intelligence.pdfUnit 3 Emotional Intelligence and Spiritual Intelligence.pdf
Unit 3 Emotional Intelligence and Spiritual Intelligence.pdf
 
General Principles of Intellectual Property: Concepts of Intellectual Proper...
General Principles of Intellectual Property: Concepts of Intellectual  Proper...General Principles of Intellectual Property: Concepts of Intellectual  Proper...
General Principles of Intellectual Property: Concepts of Intellectual Proper...
 
Mehran University Newsletter Vol-X, Issue-I, 2024
Mehran University Newsletter Vol-X, Issue-I, 2024Mehran University Newsletter Vol-X, Issue-I, 2024
Mehran University Newsletter Vol-X, Issue-I, 2024
 
Exploring_the_Narrative_Style_of_Amitav_Ghoshs_Gun_Island.pptx
Exploring_the_Narrative_Style_of_Amitav_Ghoshs_Gun_Island.pptxExploring_the_Narrative_Style_of_Amitav_Ghoshs_Gun_Island.pptx
Exploring_the_Narrative_Style_of_Amitav_Ghoshs_Gun_Island.pptx
 
Micro-Scholarship, What it is, How can it help me.pdf
Micro-Scholarship, What it is, How can it help me.pdfMicro-Scholarship, What it is, How can it help me.pdf
Micro-Scholarship, What it is, How can it help me.pdf
 
The basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxThe basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptx
 
REMIFENTANIL: An Ultra short acting opioid.pptx
REMIFENTANIL: An Ultra short acting opioid.pptxREMIFENTANIL: An Ultra short acting opioid.pptx
REMIFENTANIL: An Ultra short acting opioid.pptx
 
Holdier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfHoldier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdf
 
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
 
Towards a code of practice for AI in AT.pptx
Towards a code of practice for AI in AT.pptxTowards a code of practice for AI in AT.pptx
Towards a code of practice for AI in AT.pptx
 
COMMUNICATING NEGATIVE NEWS - APPROACHES .pptx
COMMUNICATING NEGATIVE NEWS - APPROACHES .pptxCOMMUNICATING NEGATIVE NEWS - APPROACHES .pptx
COMMUNICATING NEGATIVE NEWS - APPROACHES .pptx
 

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>