Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- use PHPMailerPHPMailerPHPMailer;
- use PHPMailerPHPMailerException;
- require 'vendor/autoload.php';
- $mail = new PHPMailer(true);
- //$mail->SMTPDebug = 2;
- //$mail->isSMTP();
- $mail->Host = 'smtp.gmail.com';
- $mail->SMTPAuth = true;
- $mail->Username = 'myemail@gmail.com';
- $mail->Password = 'mypassword';
- $mail->SMTPSecure = 'ssl';
- $mail->Port = 587;
- $mail->setFrom('myemail@gmail.com', 'Mailer');
- $mail->addAddress('example@gmail.com', 'Joe User');
- $mail->isHTML(true);
- $mail->Subject = 'Here is the subject';
- $mail->Body = 'This is the HTML message body <b>in bold!</b>';
- if($mail->send()){
- echo 'Message has been sent successfully';
- } else {
- echo 'Message could not be sent. Mailer Error: ', $mail->ErrorInfo;
- }
Add Comment
Please, Sign In to add comment