Advertisement
Guest User

help

a guest
Apr 18th, 2019
1,331
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.04 KB | None | 0 0
  1. // Load PHP Mailer programme
  2. require __DIR__ . '\libraries\PHPMailerAutoload.php';
  3.  
  4. $mail = new PHPMailer();
  5. try{
  6. mail('thefalation@gmail.com', 'hpo', 'gdb');
  7. // Send mail using gmail; prepare settings for the mail server
  8. $mail->isSMTP(); // Set mailer to use SMTP
  9. $mail->Host = "smtp.mailtrap.io"; // Specify main and backup SMTP servers
  10. $mail->SMTPAuth = true; // Enable SMTP authentication
  11. $mail->Username = "a523f0e813eb20"; // GMAIL username
  12. $mail->Password = "ba0b14969966e0"; // GMAIL password
  13. $mail->SMTPSecure = "ssl"; // Enable SSL encryption, `tls` also accepted
  14. $mail->Port = 465; // set the SMTP port for the GMAIL server; was 465 / 587
  15.  
  16. // Can be found e.g. in your Outlook account settings
  17. // Prepare email message
  18. $senderNaam = "Webmaster Webshop";
  19. $mail->addAddress($email, $naam); // Add a recipient
  20. $mail->setFrom($senderMail, $senderNaam); // Set sender data
  21.  
  22. // Alternatively:
  23. // $mail->From = 'thefalation@gmail.com;
  24. // $mail->FromName = 'Sender’s Name';
  25. $mail->addReplyTo('thefalation@gmail.com', 'WebshopWorld');
  26.  
  27. // $mail->addCC('cc@example.com');
  28. // $mail->addBCC('bcc@example.com');
  29. $bodyContent = '<h2>Deze email wordt gestuurd in HTML m.b.v. PHP in Localhost door De Webshop</h2>';
  30. $bodyContent.= '<p>Geachte ' . $naam . ', Hierbij bevestigen wij uw aanmelding. </p><p>U heeft een account bij De Webshop.</p>';
  31. $mail->isHTML(true); // Set email format to HTML
  32. $mail->Subject = "Uw aanmelding bij Webshop";
  33. $mail->Body = $bodyContent;
  34. }
  35. catch(PDOException $e) {
  36. echo ("<script>alert('Account NIET aangemaakt.');location.href='index.php?page=inloggen';</script>");
  37. }
  38. // Add attachments
  39. // $mail->addAttachment('/var/tmp/file.tar.gz');
  40. // $mail->addAttachment('/tmp/image.jpg', 'new.jpg'); // Optional name
  41. // Send email
  42. try {
  43. $mail->send();
  44. echo "<script>alert('Er is een bevestiging verzonden naar uw e-mail'); location.href='index.php?page=inloggen';</script>";
  45. }
  46.  
  47. catch(Exception $e) {
  48. echo "<script>alert('Fail - ' + $mail->ErrorInfo);</script>";
  49. }
  50. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement