Search
 
SCRIPT & CODE EXAMPLE
 

PHP

How to automail in php

<?php
include_once 'database.php';
$first_name = $_POST['first_name'];
$last_name = $_POST['last_name'];
$city_name = $_POST['city_name'];
$email = $_POST['email'];

/* sql query for inserting data into database */

mysqli_query($conn,"insert into employee (first_name,last_name,city_name,email) values ('$first_name','$last_name','$city_name','$email')") or die(mysqli_error());
require_once 'mailer/class.phpmailer.php';
/* creates object */
$mail = new PHPMailer(true);
$mailid = $email;
$subject = "Thank u";
$text_message = "Hello";
$message = "Thank You for Contact with us.";

try
{
$mail->IsSMTP();
$mail->isHTML(true);
$mail->SMTPDebug = 0;
$mail->SMTPAuth = true;
$mail->SMTPSecure = "ssl";
$mail->Host = "smtp.gmail.com";
$mail->Port = '465';
$mail->AddAddress($mailid);
$mail->Username ="divyasundarsahu@gmail.com";
$mail->Password ="password@123";
$mail->SetFrom('divyasundarsahu@gmail.com','Divyasundar Sahu');
$mail->AddReplyTo("divyasundarsahu@gmail.com","Divyasundar Sahu");
$mail->Subject = $subject;
$mail->Body = $message;
$mail->AltBody = $message;
if($mail->Send())
{
echo "Thank you for register u got a notification through the mail you provide";
}
}
catch(phpmailerException $ex)
{
$msg = "
".$ex->errorMessage()."
";
}
?>
Comment

PREVIOUS NEXT
Code Example
Php :: Attempt to read property "headers" on string 
Php :: test not found page symfiny in dev 
Php :: wpdb insert or if exists update 
Php :: php is multiple of 
Php :: php jwt firebase 
Php :: Adding Conditional Classes to Menu Items 
Php :: how to fix Undefined variable: product (View: C:xampphtdocsecommerce esourcesviewslivewireshop-component.blade.php) 
Php :: php code for english translation optin 
Php :: wc php coupon applied message still after coupon delete 
Php :: google api for language translation in php 
Php :: php mysql insert record if not exists in table 
Php :: PHP str_getcsv — Parse a CSV string into an array 
Php :: pengulangan php 
Php :: get basename without extension Laravel 
Php :: Error when uploading image into phpmyadmin using PDO in php 
Php :: comment acceder à la base de données phpmyadmin sur mac ave 
Php :: get.krnl.key 
Php :: appserviceprovider laravel share common settings for all controllers 
Php :: First-class Callable Syntax - PHP 8.1 
Php :: returning two yajra datatable using single method on the sam view laravel 
Php :: launch new tab and refresh original page codeigniter 
Php :: hook into admin add order item / product on add/submit 
Php :: option to have array in function parameter 
Php :: saber value ao escolher combobox php 
Php :: how to get count of rows in a table in laravel query 
Php :: show number 1 as 00001 laravel 
Php :: php check how long a function took to exexute 
Php :: Call to a member function move() on null 
Php :: laravel get file size uploaded 
Php :: codeception field datetime firefox 
ADD CONTENT
Topic
Content
Source link
Name
7+1 =