Advertisement
smaction

Mail code.

Jan 3rd, 2019
201
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.79 KB | None | 0 0
  1. // add mail function
  2.  
  3.  
  4. //Create a new PHPMailer instance
  5.     $mail = new PHPMailer(true);
  6. // Set PHPMailer to use the sendmail transport
  7.     $mail->isSendmail();
  8. //Set who the message is to be sent from
  9.     $mail->setFrom('xxxxxx@yyyyy.com');
  10. //Set an alternative reply-to address
  11. //    $mail->addReplyTo('replyto@example.com', 'First Last');
  12. //Set who the message is to be sent to
  13.     $mail->addAddress('xxxxxx@wyyyyy.com');
  14. //Set the subject line
  15.     $mail->Subject = 'Rework Report';
  16.  
  17.  
  18.     $mail->Body = 'Here is the weekly rework report.';
  19.  
  20. //Attach an image file
  21.     $mail->addAttachment('current/rework.txt');
  22. //send the message, check for errors
  23.     if (!$mail->send()) {
  24.         echo "Mailer Error: " . $mail->ErrorInfo;
  25.     } else {
  26.         echo "Message sent!";
  27.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement