Advertisement
Guest User

Untitled

a guest
Sep 30th, 2016
95
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.86 KB | None | 0 0
  1. <?php
  2.  
  3. namespace Api\mail;
  4.  
  5. require '../../vendor/phpmailer/phpmailer/PHPMailerAutoload.php';
  6.  
  7. use \PHPMailer;
  8.  
  9.  
  10. class Mail
  11. {
  12.  
  13.     public function send($data)
  14.     {
  15.  
  16.         $mail = new PHPMailer;
  17.  
  18.         $mail->SMTPDebug = 2;
  19.         $mail->Debugoutput = 'html';
  20.         $mail->Host = 'smtp.berryproject.com';
  21.         $mail->Port = 587;
  22.         $mail->SMTPAuth = true;
  23.         $mail->Username = "axel.rataj@berryproject.com";
  24.         $mail->Password = "qwe123";
  25.         $mail->setFrom('contact@contact.pl', 'First Last');
  26.         $mail->addAddress('ar@berryproject.com', 'John Doe');
  27.         $mail->Subject = 'Formularz kontaktowy';
  28.         $mail->Body = include '../mail/mail.php';
  29.  
  30.  
  31.         if (!$mail->send()) {
  32.             echo "Mailer Error: " . $mail->ErrorInfo;
  33.         } else {
  34.             echo "Message sent!";
  35.         }
  36.  
  37.     }
  38.  
  39. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement