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

how to create php message 00

<?php session_start()?>
<!doctype html>
<html lang="en">
	<head>
		<meta charset="UTF-8" name="viewport" content="width=device-width, initial-scale=1"/>
		<link rel="stylesheet" type="text/css" href="css/bootstrap.css"/>
	</head>
<body>
	<nav class="navbar navbar-default">
		<div class="container-fluid">
			<a class="navbar-brand" href="https://campcodes.com">CampCodes</a>
		</div>
	</nav>
	<div class="col-md-3"></div>
	<div class="col-md-6 well">
		<h3 class="text-primary">PHP - Send Mail To Gmail Using PHPMailer</h3>
		<hr style="border-top:1px dotted #ccc;"/>
		<div class="col-md-3"></div>
		<div class="col-md-6">
			<form method="POST" action="send_email.php">
				<div class="form-group">
					<label>Email:</label>
					<input type="email" class="form-control" name="email" required="required"/>
				</div>
				<div class="form-group">
					<label>Subject</label>
					<input type="text" class="form-control" name="subject" required="required"/>
				</div>
				<div class="form-group">
					<label>Message</label>
					<input type="text" class="form-control" name="message" required="required"/>
				</div>
				<center><button name="send" class="btn btn-primary"><span class="glyphicon glyphicon-envelope"></span> Send</button></center>
			</form>
			<br />
			<?php
				if(ISSET($_SESSION['status'])){
					if($_SESSION['status'] == "ok"){
			?>
						<div class="alert alert-info"><?php echo $_SESSION['result']?></div>
			<?php
					}else{
			?>
						<div class="alert alert-danger"><?php echo $_SESSION['result']?></div>
			<?php
					}
 
					unset($_SESSION['result']);
					unset($_SESSION['status']);
				}
			?>
		</div>
	</div>
</body>
</html>
Comment

PREVIOUS NEXT
Code Example
Php :: php in browser 
Php :: what Permissions do I need for include folder on php 
Php :: how to convert youtube video to mp3 in php 
Php :: laravel display multiple selected values 
Php :: php elvis operator 
Php :: how to save array of inputs in php 
Php :: laravel carbon y-m-d 
Php :: schema add column laravel 
Php :: php mask credit card number 
Java :: java get screen size 
Java :: javafx center node in gridpane 
Java :: java enum get nex 
Java :: copy to clipboard java 
Java :: java main 
Java :: javafx dependency 
Java :: java filewriter new line 
Java :: nanotime to milliseconds java 
Java :: JFrame Exit oon close Java20 
Java :: java selenium new empty window 
Java :: transparent background android studio 
Java :: is grepper legit 
Java :: int array to set in java 
Java :: java get creation date of file 
Java :: read int from keyboard java 
Java :: how to get the time in java 
Java :: how to deselect radio button in java 
Java :: force fullscreen jframe 
Java :: java show error dialog 
Java :: JLabel not centering 
Java :: difference between premitive and non-premitive 
ADD CONTENT
Topic
Content
Source link
Name
5+9 =