✏️ 正在编辑: send_mail.php
路径:
/home/llpreacharge/public_html/Admin1/testMail/send_mail.php
提示:
您可以编辑任何文件(包括二进制文件),但请注意不当修改可能导致文件损坏。
<?php include'../connection.php'; ob_start(); $longlifepro111GmailAppPassword="excymghvisovqzep"; $fromMail="longlifepro111@gmail.com"; $fromName="LLP RECHARGE"; $fromMailAppPasword=$longlifepro111GmailAppPassword; /* $toMail="sameermansuri111@gmail.com"; $toName="Sameer"; $subjectMail="Test Mail"; $msgMail="This Is My Mail Message 2"; */ //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; require 'PHPMailer/src/Exception.php'; require 'PHPMailer/src/PHPMailer.php'; require 'PHPMailer/src/SMTP.php'; //Load Composer's autoloader //require 'vendor/autoload.php'; //Create an instance; passing `true` enables exceptions $mail = new PHPMailer(true); try { //Server settings $mail->SMTPDebug = 2; //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 = $fromMail; //SMTP username $mail->Password = $fromMailAppPasword; //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($fromMail, $fromName); $mail->addAddress($toMail, $toName); //Add a recipient //$mail->addAddress('sameermansuri111@gmail.com'); //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 = $subjectMail; $mail->Body = $msgMail; //$mail->AltBody = 'This is the body in plain text for non-HTML mail clients2'; $mail->send(); //echo 'Message has been sent'; } catch (Exception $e) { //echo "Message could not be sent. Mailer Error: {$mail->ErrorInfo}"; } ob_end_clean(); ?>
💾 保存文件
← 返回文件管理器