Advertisement
Guest User

Untitled

a guest
Apr 6th, 2017
638
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.59 KB | None | 0 0
  1. <?php
  2. require 'PHPMailer-master/PHPMailerAutoload.php';
  3.  
  4. $mail = new PHPMailer;
  5.  
  6. //$mail->isSMTP(); // Set mailer to use SMTP
  7. $mail->Host = 'ssl://imap.gmail.com'; // Specify main and backup server
  8. $mail->SMTPAuth = true; // Enable SMTP authentication
  9. $mail->Username = 'miko.dewaweb@gmail.com'; // SMTP username
  10. $mail->Password = '*****'; // SMTP password
  11. $mail->SMTPSecure = 'tls'; // Enable encryption, 'ssl' also accepted
  12. $mail->Port = 587; //Set the SMTP port number - 587 for authenticated TLS
  13. $mail->setFrom('miko.dewaweb@gmail.com', 'miko'); //Set who the message is to be sent from
  14. $mail->addReplyTo('andry.jatmiko@dewaweb.com', 'First Last'); //Set an alternative reply-to address
  15. $mail->addAddress('andry.jatmiko@dewaweb.com', 'miko'); // Add a recipient
  16. $mail->addAddress('andry.jatmiko@dewaweb.com'); // Name is optional
  17. $mail->addCC('miko.dewaweb@gmail.com');
  18. $mail->addBCC('miko.dewaweb@gmail.com');
  19. $mail->WordWrap = 50; // Set word wrap to 50 characters
  20. $mail->isHTML(true); // Set email format to HTML
  21.  
  22. $mail->Subject = 'Here is the subject';
  23. $mail->Body = 'Hello, this is my message.';
  24. $mail->AltBody = 'This is the body in plain text for non-HTML mail clients';
  25. if(!$mail->send()) {
  26. echo 'Message could not be sent.';
  27. echo 'Mailer Error: ' . $mail->ErrorInfo;
  28. exit;
  29. }
  30.  
  31. echo 'Message has been sent';
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement