Advertisement
Guest User

Untitled

a guest
Nov 23rd, 2015
114
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.23 KB | None | 0 0
  1. <?php
  2.  
  3. include('PHPMailerAutoload.php');
  4. $mail = new PHPMailer();
  5.  
  6. //$mail->IsSMTP(); // telling the class to use SMTP
  7. // $mail->Host = "localhost"; // SMTP server
  8. //IsSMTP(); // send via SMTP
  9. $mail->Host = "ssl://smtp.gmail.com"; // SMTP server Gmail
  10. $mail->Mailer = "smtp";
  11. $mail->SMTPAuth = true; // turn on SMTP authentication
  12.  
  13. $mail->Username = "email@gmail.com"; //
  14. $mail->Password = "password"; // SMTP password
  15. $webmaster_email = "username@domain.com"; //Reply to this email ID
  16. $email="harry.luanda@gmail.com"; // Recipients email ID
  17. $name="Harry"; // Recipient’s name
  18. $mail->From = $webmaster_email;
  19. $mail->FromName = "Webmaster";
  20. $mail->AddAddress($email,$name);
  21. $mail->AddReplyTo($webmaster_email,"Webmaster");
  22. $mail->WordWrap = 50; // set word wrap
  23. $mail->AddAttachment("/var/tmp/file.tar.gz"); // attachment
  24. $mail->AddAttachment("/tmp/image.jpg", "new.jpg"); // attachment
  25. $mail->IsHTML(true); // send as HTML
  26. $mail->Subject = "This is the subject";
  27. $mail->Body = "Hi,This is the HTML BODY "; //HTML Body
  28. $mail->AltBody = "This is the body when user views in plain text format"; //Text Body
  29. if(!$mail->Send())
  30. {
  31. echo "Mailer Error: " . $mail->ErrorInfo;
  32. }
  33. else
  34. {
  35. echo "Message has been sent";
  36. }
  37.  
  38. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement