-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
6b8b34c
commit 7b70400
Showing
1 changed file
with
36 additions
and
38 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,46 +5,44 @@ | |
use PHPMailer\PHPMailer\SMTP; | ||
use PHPMailer\PHPMailer\Exception; | ||
|
||
if(isset($_POST['send'])) | ||
{ | ||
$name = $_POST['name']; | ||
$email = $_POST['email']; | ||
$msg = $_POST['message']; | ||
} | ||
$fe_value = $name . " " . $email . " " . $msg; | ||
echo_r $fe_value; | ||
//Load Composer's autoloader | ||
require 'PHPMailer/Exception.php'; | ||
require 'PHPMailer/PHPMailer.php'; | ||
require 'PHPMailer/SMTP.php'; | ||
echo "20"; | ||
//Create an instance; passing `true` enables exceptions | ||
$mail = new PHPMailer(true); | ||
echo "23"; | ||
try { | ||
//Server settings //Enable verbose debug output | ||
$mail->isSMTP(); //Send using SMTP | ||
$mail->Host = 'smtp.gmail.com'; //Set the SMTP server to send through | ||
$mail->SMTPAuth = true; //Enable SMTP authentication | ||
$mail->Username = '[email protected]'; //SMTP username | ||
$mail->Password = 'mfthljozqjzyygji'; //SMTP password | ||
$mail->SMTPSecure = PHPMailer::ENCRYPTION_SMTPS; //Enable implicit TLS encryption | ||
$mail->Port = 465; //TCP port to connect to; use 587 if you have set `SMTPSecure = PHPMailer::ENCRYPTION_STARTTLS` | ||
|
||
//Recipients | ||
$mail->setFrom('[email protected]', 'Contact-Form'); | ||
$mail->addAddress('[email protected]', 'Owner'); //Add a recipient | ||
|
||
|
||
//Optional name | ||
|
||
//Content | ||
$mail->isHTML(true); //Set email format to HTML | ||
$mail->Subject = 'Contact -form'; | ||
$mail->Body = "Sender Name -$name <br> Sender Email - $email <br> Message - $msg"; | ||
n | ||
$mail->send(); | ||
echo 'Message has been sent'; | ||
} catch (Exception $e) { | ||
echo "Message could not be sent. Mailer Error: {$mail->ErrorInfo}"; | ||
|
||
if(isset($_POST['send'])) { | ||
$name = $_POST['name']; | ||
$email = $_POST['email']; | ||
$msg = $_POST['message']; | ||
|
||
//Create an instance; passing `true` enables exceptions | ||
$mail = new PHPMailer(true); | ||
|
||
try { | ||
//Server settings | ||
$mail->isSMTP(); //Send using SMTP | ||
$mail->Host = 'smtp.gmail.com'; //Set the SMTP server to send through | ||
$mail->SMTPAuth = true; //Enable SMTP authentication | ||
$mail->Username = '[email protected]'; //SMTP username | ||
$mail->Password = 'mfthljozqjzyygji'; //SMTP password | ||
$mail->SMTPSecure = PHPMailer::ENCRYPTION_SMTPS; //Enable implicit TLS encryption | ||
$mail->Port = 465; //TCP port to connect to; use 587 if you have set `SMTPSecure = PHPMailer::ENCRYPTION_STARTTLS` | ||
|
||
//Recipients | ||
$mail->setFrom('[email protected]', 'Contact-Form'); | ||
$mail->addAddress('[email protected]', 'Owner'); //Add a recipient | ||
|
||
//Optional name | ||
|
||
//Content | ||
$mail->isHTML(true); //Set email format to HTML | ||
$mail->Subject = 'Contact -form'; | ||
$mail->Body = "Sender Name - $name <br> Sender Email - $email <br> Message - $msg"; | ||
|
||
$mail->send(); | ||
echo 'Message has been sent'; | ||
} catch (Exception $e) { | ||
echo "Message could not be sent. Mailer Error: {$mail->ErrorInfo}"; | ||
} | ||
} | ||
?> |