Advertisement
Guest User

Untitled

a guest
Jan 10th, 2017
167
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.10 KB | None | 0 0
  1. $mail->isSMTP(true);                                      // Set mailer to use SMTP
  2. $mail->Host = 'smtp.gmail.com';  // Specify main and backup SMTP servers
  3. $mail->SMTPAuth = true;                               // Enable SMTP authentication
  4. $mail->Username = 'romansheep.business@gmail.com';                 // SMTP username
  5. $mail->Password = $password;                         // SMTP password
  6. $mail->SMTPSecure = 'tls';                            // Enable TLS encryption, `ssl` also accepted
  7. $mail->Port = 587;                                    // TCP port to connect to
  8.  
  9. $mail->setFrom($email, $name);
  10. $mail->addAddress('romakcz@gmail.com', 'Joe User');     // Add a recipient               // Name is optional
  11.  
  12. $mail->isHTML(true);                                  // Set email format to HTML
  13.  
  14. $mail->Subject = $subject;
  15. $mail->Body    = $message;
  16. $mail->AltBody = $message;
  17.  
  18. if($mail->send()) {
  19.     $send_email = 'Your email was succesfully send!';
  20.     $err = $mail->ErrorInfo;
  21.     echo $err;
  22. }
  23. else {
  24.     $send_email = 'There was an error with sending the email. Please try again later!';
  25. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement