Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- require_once "vendor/autoload.php";
- $mail = new PHPMailer;
- //Enable SMTP debugging.
- $mail->SMTPDebug = 3;
- //Set PHPMailer to use SMTP.
- $mail->isSMTP();
- //Set SMTP host name
- $mail->Host = "smtp.gmail.com";
- //Set this to true if SMTP host requires authentication to send email
- $mail->SMTPAuth = true;
- //Provide username and password
- $mail->Username = "name@gmail.com";
- $mail->Password = "super_secret_password";
- //If SMTP requires TLS encryption then set it
- $mail->SMTPSecure = "tls";
- //Set TCP port to connect to
- $mail->Port = 587;
- $mail->From = "name@gmail.com";
- $mail->FromName = "Full Name";
- $mail->addAddress("name@example.com", "Recepient Name");
- $mail->isHTML(true);
- $mail->Subject = "Subject Text";
- $mail->Body = "<i>Mail body in HTML</i>";
- $mail->AltBody = "This is the plain text version of the email content";
- if(!$mail->send())
- {
- echo "Mailer Error: " . $mail->ErrorInfo;
- }
- else
- {
- echo "Message has been sent successfully";
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement