D7net
Home
Console
Upload
information
Create File
Create Folder
About
Tools
:
/
home
/
u935876328
/
domains
/
gharsajavat.com
/
public_html
/
Filename :
sendMail.php
back
Copy
<?php $rdir = str_replace("\\", "/", __DIR__); //Root Dir require $rdir.'/PHPMailer/src/Exception.php'; require $rdir.'/PHPMailer/src/PHPMailer.php'; require $rdir.'/PHPMailer/src/SMTP.php'; use PHPMailer\PHPMailer\PHPMailer; use PHPMailer\PHPMailer\SMTP; $mail = new PHPMailer(true); $name = $_POST['name']; $mobile = $_POST['mobile']; $subject = ""; $message = $_POST['message']; // Settings $mail->IsSMTP(); $mail->CharSet = 'UTF-8'; //Server settings $mail->SMTPDebug = false; //Enable verbose debug output $mail->isSMTP(); //Send using SMTP $mail->Host = 'smtp.hostinger.com'; //Set the SMTP server to send through $mail->SMTPAuth = true; //Enable SMTP authentication $mail->Username = 'admin@gharsajavat.com'; //SMTP username $mail->Password = 'Gharsajavat@123'; //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` $mail->setFrom('admin@gharsajavat.com'); $mail->addAddress('gharsajavatgnr@gmail.com', 'Gharsajavat'); // Content $mail->isHTML(true); // Set email format to HTML $mail->Subject = 'Inquiry by '.$name; $mail->Body = 'Hello Gharsajavt, <br> You have one inquiry from '.$name.', please see all details below <br><br> <table border="1"> <tr> <th>Name</th> <td>'.$name.'</td> </tr> <tr> <th>Mobile</th> <td>'.$mobile.'</td> </tr> <tr> <th>Message</th> <td style="white-space: pre-wrap;">'.$message.'</td> </tr> </table>'; $mail->send(); echo 'OK'; ?>