Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- use PHPMailer\PHPMailer\PHPMailer;
- use PHPMailer\PHPMailer\SMTP;
- use PHPMailer\PHPMailer\Exception;
- require_once '../vendor/autoload.php';
- $mail = new PHPMailer(true);
- //Configure SMTP
- $mail->isSMTP();
- $mail->Host = 'smtp.gmail.com';
- $mail->SMTPAuth = true;
- $mail->Username = 'acho.chuchi.8@gmail.com';
- $mail->Password = 'jgyb jkzr vizi vmsn';
- $mail->SMTPSecure = PHPMailer::ENCRYPTION_STARTTLS;
- $mail->Port = 587;
- //sender information
- $mail->setFrom('acho.chuchi.8@gmail.com', 'TeRackSito');
- //receiver email address and name
- $mail->addAddress('etiennesmtnf@gmail.com', 'Estienne');
- // Add cc or bcc
- // $mail->addCC('email@mail.com');
- // $mail->addBCC('user@mail.com');
- $mail->isHTML(false);
- $mail->Subject = 'Estienne';
- $mail->Body = "Hello Estienne,\n\nThis is a test email.\n\nGoodbye,\nTeRackSito";
- // $mail->addAttachment('/path/to/file1.pdf', 'CustomName1.pdf'); // Attachment 1
- // Attempt to send the email
- if (!$mail->send()) {
- echo 'Email not sent. An error was encountered: ' . $mail->ErrorInfo;
- } else {
- echo 'Message has been sent.';
- }
- $mail->smtpClose();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement