Guest User

Untitled

a guest
Mar 21st, 2018
355
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.75 KB | None | 0 0
  1. SMTP = smtp.example.com
  2. smtp_port = 25
  3. username = info@example.com
  4. password = yourmailpassord
  5. sendmail_from = info@example.com
  6.  
  7. smtp_server=smtp.gmail.com
  8. smtp_port=465
  9. auth_username=user@gmail.com
  10. auth_password=your_password
  11.  
  12. [mail function]
  13. ; For Win32 only.
  14. SMTP = mail.yourserver.com
  15. smtp_port = 25
  16. auth_username = smtp-username
  17. auth_password = smtp-password
  18. sendmail_from = you@yourserver.com
  19.  
  20. <?php
  21. $message = "test message body";
  22. $result = mail('recipient@some-domain.com', 'message subject', $message);
  23. echo "result: $result";
  24. ?>
  25.  
  26. #Relay config
  27. relayhost = smtp.server.net
  28. smtp_use_tls=yes
  29. smtp_sasl_auth_enable=yes
  30. smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd
  31. smtp_tls_CAfile = /etc/postfix/cacert.pem
  32. smtp_sasl_security_options = noanonymous
  33.  
  34. smtp.server.net username:password
  35.  
  36. composer require phpmailer/phpmailer
  37.  
  38. # use namespace
  39. use PHPMailerPHPMailerPHPMailer;
  40.  
  41. # require php mailer
  42. require_once "../vendor/autoload.php";
  43.  
  44. //PHPMailer Object
  45. $mail = new PHPMailer;
  46.  
  47. //From email address and name
  48. $mail->From = "from@yourdomain.com";
  49. $mail->FromName = "Full Name";
  50.  
  51. //To address and name
  52. $mail->addAddress("recepient1@example.com", "Recepient Name");
  53. $mail->addAddress("recepient1@example.com"); //Recipient name is optional
  54.  
  55. //Address to which recipient will reply
  56. $mail->addReplyTo("reply@yourdomain.com", "Reply");
  57.  
  58. //CC and BCC
  59. $mail->addCC("cc@example.com");
  60. $mail->addBCC("bcc@example.com");
  61.  
  62. //Send HTML or Plain Text email
  63. $mail->isHTML(true);
  64.  
  65. $mail->Subject = "Subject Text";
  66. $mail->Body = "<i>Mail body in HTML</i>";
  67. $mail->AltBody = "This is the plain text version of the email content";
  68.  
  69. if(!$mail->send())
  70. {
  71. echo "Mailer Error: " . $mail->ErrorInfo;
  72. }
  73. else
  74. {
  75. echo "Message has been sent successfully";
  76. }
Add Comment
Please, Sign In to add comment