Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $mail = new PHPMailer;
- $mail->SMTPDebug = 2; // Enable verbose debug output
- $mail->isSMTP(); // Set mailer to use SMTP
- $mail->Host = 'smtp.gmail.com'; // Specify main and backup SMTP servers
- $mail->SMTPAuth = true; // Enable SMTP authentication
- $mail->Username = 'example@gmail.com'; // SMTP username
- $mail->Password = 'mypassword'; // SMTP password
- $mail->SMTPSecure = 'tls'; // Enable TLS encryption, `ssl` also accepted
- $mail->Port = 587;
- $mail->setFrom('example@gmail.com', 'Your Name');
- $mail->addAddress('example@gmail.com', 'My Friend');
- $mail->Subject = 'First PHPMailer Message';
- $mail->Body = 'Hi! This is my first e-mail sent through PHPMailer.';
- if(!$mail->send()) {
- echo 'Message was not sent.';
- echo 'Mailer error: ' . $mail->ErrorInfo;
- } else {
- echo 'Message has been sent.';
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement