Advertisement
abhijit5893

PHPMailer

Apr 21st, 2013
5,820
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.22 KB | None | 0 0
  1. <?php
  2. require_once “phpmailer/class.phpmailer.php”;
  3. $mail = new PHPMailer();
  4. $mail->IsSMTP(); // send via SMTP
  5. $mail->SMTPAuth = true; // turn on SMTP authentication
  6. $mail->Username = ”yourusername@gmail.com“; // Enter your SMTP username
  7. $mail->Password = ”yourpassword“; // SMTP password
  8. $webmaster_email = ”yourusername@yourdoamin.com“; //Add reply-to email address
  9. $email=”yourusername@domain.com“; // Add recipients email address
  10. $name=”name“; // Add Your Recipient’s name
  11. $mail->From = $webmaster_email;
  12. $mail->FromName = ”Webmaster”;
  13. $mail->AddAddress($email,$name);
  14. $mail->AddReplyTo($webmaster_email,”Webmaster”);
  15. $mail->WordWrap = <strong>50</strong>; // set word wrap
  16. $mail->AddAttachment(/var/tmp/file.tar.gz”); // attachment
  17. $mail->AddAttachment(/tmp/image.jpg”,new.jpg”); // attachment
  18. $mail->IsHTML(true); // send as HTML
  19.  
  20. $mail->Subject = ”This is your subject“;
  21.  
  22. $mail->Body =      ”Hi, this is your email body, etc, etc” ;      //HTML Body
  23.  
  24. $mail->AltBody = ”Hi, this is your email body, etc, etc“;     //Plain Text Body
  25. if(!$mail->Send()){
  26. echo “Mailer Error:. $mail->ErrorInfo;
  27. } else {
  28. echo “Message has been sent”;
  29. }
  30. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement