Advertisement
Guest User

Untitled

a guest
Aug 23rd, 2017
458
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.27 KB | None | 0 0
  1. <html>
  2. <head>
  3. <title>Test</title>
  4. </head>
  5. <body>
  6. <?php  
  7. require("phpmailer/_lib/class.phpmailer.php");  
  8. $mail = new PHPMailer(true);
  9. $mail->isSMTP();                                      // Set mailer to use SMTP
  10. $mail->Host = 'smtp.gmail.com';  // Specify main and backup SMTP servers
  11. $mail->SMTPAuth = true;                               // Enable SMTP authentication
  12. $mail->Username = 'user@gmail.com';                 // SMTP username
  13. $mail->Password = 'password';                           // SMTP password
  14. $mail->SMTPSecure = 'tls';                            // Enable TLS encryption, `ssl` also accepted
  15. $mail->Port = 587;                                    // TCP port to connect to
  16.  
  17. $mail->setFrom('user@gmail.com', 'Mailer');
  18. $mail->addAddress('empfänger@gmail.com', 'Empfänger');     // Add a recipient
  19. $mail->addReplyTo('user@gmail.com', 'Information');
  20.  
  21. $mail->isHTML(true);                                  // Set email format to HTML
  22.  
  23. $mail->Subject = 'Here is the subject';
  24. $mail->Body    = 'This is the HTML message body <b>in bold!</b>';
  25. $mail->AltBody = 'This is the body in plain text for non-HTML mail clients';
  26. try{
  27.     $mail->send();
  28.     echo 'Message has been sent';
  29. }
  30. catch{
  31.     echo 'Message could not be sent.';
  32. }
  33. ?>  
  34. </body>
  35. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement