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 $argv echo 
Php :: php date() 
Php :: Artisan namespace 
Php :: preg_split 
Php :: how to determine if file is empty in php 
Php :: mysql_real_escape_string 
Php :: laravel array to string conversion 
Php :: how to use wherehas in laravel 
Php :: carbon this month first day 
Php :: php configuration in apache server 2.4 
Php :: replace last two characters string php 
Php :: laravel logout after password change 
Php :: laravel route pattern 
Php :: reverse string php 
Php :: get diff array php 
Php :: laravel phpunit not run test 
Php :: laravel relation with limit 
Php :: install multiple php versions windows xampp 
Php :: sha256 php cantidad caracteres 
Php :: laravel migration text length 
Php :: Woocommerce Changing the Entry Title of the Custom Endpoint 
Php :: theme mod disalow wp 
Php :: spatie laravel pdf image 
Php :: Skip model mutator 
Php :: php file date created older than 
Php :: twig render string 
Php :: php simple sse 
Php :: register_uninstall_hook 
Php :: laravel repository 
Php :: View [layouts.master] not found 
ADD CONTENT
Topic
Content
Source link
Name
2+9 =