Advertisement
Guest User

Untitled

a guest
Oct 24th, 2013
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <?php
  2.  
  3. $senderName = 'Erick Best';
  4. $username = 'sender@yahoo.com';
  5. $password = 'your yahoo password';
  6.  
  7. $recipients = array(
  8.     'erickbestism@gmail.com' => 'Erick Best',
  9.     'receiver@yahoo.com' => 'Yahoo User',
  10. );
  11.  
  12. require '../PHPMailerAutoload.php';
  13.  
  14. //Create a new PHPMailer instance
  15. $mail = new PHPMailer();
  16.  
  17. // Set up SMTP
  18. $mail->IsSMTP();
  19. $mail->SMTPAuth   = true;
  20. $mail->Host       = "smtp.mail.yahoo.com";
  21. $mail->Port       = 465;
  22. $mail->Username   = $username
  23. $mail->Password   = $password
  24.  
  25. // Build the message
  26. $mail->Subject = 'PHPMailer mail() test';
  27. $mail->msgHTML(file_get_contents('contents.html'), dirname(__FILE__));
  28. $mail->AltBody = 'This is a plain-text message body';
  29. $mail->addAttachment('images/phpmailer_mini.gif');
  30.  
  31. // Set the from/to
  32. $mail->setFrom($username, $senderName);
  33. foreach ($recipients as $address => $name) {
  34.     $mail->addAddress($address, $name);
  35. }
  36.  
  37. //send the message, check for errors
  38. if (!$mail->send()) {
  39.     echo "Mailer Error: " . $mail->ErrorInfo;
  40. } else {
  41.     echo "Message sent!";
  42. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement