12345678910111213141516171819202122 |
- <?php
- use PHPMailer\PHPMailer\PHPMailer;
- require 'vendor/autoload.php';
- $mail = new PHPMailer;
- $mail->isSMTP();
- $mail->SMTPDebug = 2;
- $mail->Host = getenv('MAIL_SMTP_SERVER');
- $mail->Port = getenv('MAIL_SMTP_PORT');
- $mail->SMTPAuth = true;
- $mail->Username = getenv('MAIL_SMTP_USERNAME');
- $mail->Password = getenv('MAIL_SMTP_PASSWORD');
- $mail->setFrom(getenv('MAIL_FROM'), 'Cloudron LAMP App');
- $mail->addAddress('mail@girish.in', 'Girish Ramakrishnan');
- $mail->Subject = 'PHPMailer SMTP message (via Cloudron)';
- $mail->isHTML(true);
- $mail->Body = '<h2>Send HTML Email using SMTP in PHP</h2>';
- if (!$mail->send()) {
- echo 'Mailer Error: ' . $mail->ErrorInfo;
- } else {
- echo 'Message sent!';
- }
- ?>
|