File manager - Edit - /home/autoph/public_html/connectv1/app/mail/mail.php
Back
<?php include_once("../../cfg/db.php"); if(!isset($_POST['email']) && !isset($_POST['subject']) && !isset($_POST['message'])){ exit(); } $email_host = trim($variable['email_host']); $email_port = trim($variable['email_port']); $email_username = $variable['system_email']; $from_email_password = trim($db -> cipher($variable['system_email_password'],false)); $from_email = $db->select("SELECT value FROM `settings_notification` WHERE `name` = 'system_from_email'"); $from_recipients = $db->select("SELECT value FROM `settings_notification` WHERE `name` = 'system_email_name'"); $email_use_smtp =trim($variable['email_use_smtp']); $email = trim($_POST['email']); $subject =trim($_POST['subject']); $message =trim($_POST['message']); // echo $from_email_password; // exit; //Import PHPMailer classes into the global namespace //These must be at the top of your script, not inside a function use PHPMailer\PHPMailer\PHPMailer; use PHPMailer\PHPMailer\SMTP; use PHPMailer\PHPMailer\Exception; //Load Composer's autoloader require '../../vendor/autoload.php'; //Instantiation and passing `true` enables exceptions $mail = new PHPMailer(true); try { //Server settings $mail->SMTPDebug = SMTP::DEBUG_SERVER; //Enable verbose debug output if($email_use_smtp == "1"){ $mail->isSMTP(); //Send using SMTP $mail->Host = $email_host; //Set the SMTP server to send through $mail->SMTPAuth = true; //Enable SMTP authentication $mail->Username = $email_username; //SMTP username $mail->Password = $from_email_password; //SMTP password $mail->SMTPSecure = PHPMailer::ENCRYPTION_STARTTLS; //Enable TLS encryption; `PHPMailer::ENCRYPTION_SMTPS` encouraged $mail->Port = $email_port; //TCP port to connect to, use 465 for `PHPMailer::ENCRYPTION_SMTPS` above } //Recipients $mail->setFrom($from_email, $from_recipients); // $mail->addAddress('143clarkz@gmail.com', 'Joe User'); //Add a recipient $mail->addAddress($email); //Name is optional // $mail->addReplyTo('info@example.com', 'Information'); // $mail->addCC('cc@example.com'); // $mail->addBCC('bcc@example.com'); //Attachments // $mail->addAttachment('/var/tmp/file.tar.gz'); //Add attachments // $mail->addAttachment('/tmp/image.jpg', 'new.jpg'); //Optional name //Content $mail->isHTML(true); //Set email format to HTML $mail->Subject = $subject; $mail->Body = $message; // $mail->AltBody = $message; // added Gmail hack $mail->SMTPOptions = array( 'ssl' => array( 'verify_peer' => false, 'verify_peer_name' => false, 'allow_self_signed' => true ) ); $mail->send(); // echo 'Message has been sent'; echo "1"; } catch (Exception $e) { // echo "Message could not be sent. Mailer Error: {$mail->ErrorInfo}"; echo "0"; } ?>
| ver. 1.4 |
.
| PHP 7.3.33 | Generation time: 0 |
proxy
|
phpinfo
|
Settings