Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- use PHPMailerPHPMailerPHPMailer;
- use PHPMailerPHPMailerException;
- require '../PHPMailer/src/PHPMailer.php';
- $mail = new PHPMailer(); // create a new object
- $mail->IsSMTP(); // enable SMTP
- $mail->SMTPDebug = 1; // debugging: 1 = errors and messages, 2 = messages only
- $mail->SMTPAuth = true; // authentication enabled
- $mail->SMTPSecure = 'tls'; // secure transfer enabled REQUIRED for GMail
- $mail->Host = "smtp.gmail.com";
- $mail->Port = 587; // or 587 or 465
- $mail->IsHTML(true);
- $mail->Username = "myaccountname";
- $mail->Password = "mypassword";
- $mail->setFrom('fromemailid', 'from name');
- $mail->Subject = 'Test Mail';
- $mail->Body = 'Test mail body';
- $mail->AddAddress("someone@gmail.com");
- if (!$mail->send())
- {echo "Mailer Error: " . $mail->ErrorInfo;
- return false;
- } else {
- return true;
- }
- ?>
Add Comment
Please, Sign In to add comment