Search
 
SCRIPT & CODE EXAMPLE
 

PHP

how to create php message 3

<?php
use PHPMailerPHPMailerPHPMailer;
use PHPMailerPHPMailerException;
 
session_start();
 
if(isset($_POST['send'])){
 
    $email = $_POST['email'];
    $subject = $_POST['subject'];
    $message = $_POST['message'];
 
 
    //Load composer's autoloader
    require 'vendor/autoload.php';
 
    $mail = new PHPMailer(true);                            
    try {
        //Server settings
        $mail->isSMTP();                                     
        $mail->Host = 'smtp.gmail.com';                      
        $mail->SMTPAuth = true;                             
        $mail->Username = '1dummy2020@gmail.com';     
        $mail->Password = 'bermzwhiteknight8';             
        $mail->SMTPOptions = array(
            'ssl' => array(
            'verify_peer' => false,
            'verify_peer_name' => false,
            'allow_self_signed' => true
            )
        );                         
        $mail->SMTPSecure = 'ssl';                           
        $mail->Port = 465;                                   
 
        //Send Email
        $mail->setFrom('1dummy2020@gmail.com');
 
        //Recipients
        $mail->addAddress($email);              
        $mail->addReplyTo('1dummy2020@gmail.com');
 
        //Content
        $mail->isHTML(true);                                  
        $mail->Subject = $subject;
        $mail->Body    = $message;
 
        $mail->send();
 
       $_SESSION['result'] = 'Message has been sent';
	   $_SESSION['status'] = 'ok';
    } catch (Exception $e) {
	   $_SESSION['result'] = 'Message could not be sent. Mailer Error: '.$mail->ErrorInfo;
	   $_SESSION['status'] = 'error';
    }
 
	header("location: index.php");
 
}
?>
Comment

how to create php message 2

require 'path/to/PHPMailer/src/Exception.php';
require 'path/to/PHPMailer/src/PHPMailer.php';
require 'path/to/PHPMailer/src/SMTP.php';
Comment

PREVIOUS NEXT
Code Example
Php :: PHP Validate POST value emoty & Set 
Php :: php group subarrays by column key 
Php :: siteurl 
Php :: codeigniter query Profiling - To enable the profiler 
Php :: laravel artisan command run in route 
Php :: simplesaml php logout 
Php :: php loop through array shorthand 
Php :: remove public url laravel 
Php :: automatically create html page using php and mysql 
Php :: add code in header 
Php :: mysqldump is not recognized as an internal or external command laravel 
Php :: how do istart writing a php code 
Php :: expresions 
Php :: How to increase the WordPress Multisite Network limit for Maximum Filesize Upload? 
Php :: array.diff solution 
Php :: how to search locations in php using ajax google script 
Php :: php ctype float 
Php :: nodejs php 
Php :: laravel get fetch api request body 
Php :: ? in php 
Php :: wordpress font awesome enque 
Php :: strings functions php 
Php :: how to refresh migration in laravel without losing data 
Php :: print select mysql in php 
Java :: import collectors java 
Java :: how to check if player is in minecart using /execute 
Java :: latest dependency for snackbar android 
Java :: java filewriter new line 
Java :: how to make javafx full screen default 
Java :: ranfom number between 1 to 100 java 
ADD CONTENT
Topic
Content
Source link
Name
1+6 =