Advertisement
Guest User

Untitled

a guest
Jan 23rd, 2016
125
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.37 KB | None | 0 0
  1. You can send mail from localhost with sendmail package , sendmail package is inbuild in XAMPP. So if you are using XAMPP then you can easily send mail from localhost.
  2.  
  3. for example you can configure C:\xampp\php\php.ini and c:\xampp\sendmail\sendmail.ini for gmail to send mail.
  4.  
  5. in C:\xampp\php\php.ini find extension=php_openssl.dll and remove the semicolon from the beginning of that line to make SSL working for gmail for localhost.
  6.  
  7. in php.ini file find [mail function] and change
  8.  
  9. SMTP=smtp.gmail.com
  10. smtp_port=587
  11. sendmail_from = my-gmail-id@gmail.com
  12. sendmail_path = "\"C:\xampp\sendmail\sendmail.exe\" -t"
  13. Now Open C:\xampp\sendmail\sendmail.ini. Replace all the existing code in sendmail.ini with following code
  14.  
  15. [sendmail]
  16.  
  17. smtp_server=smtp.gmail.com
  18. smtp_port=587
  19. error_logfile=error.log
  20. debug_logfile=debug.log
  21. auth_username=my-gmail-id@gmail.com
  22. auth_password=my-gmail-password
  23. force_sender=my-gmail-id@gmail.com
  24. Now you have done!! create php file with mail function and send mail from localhost.
  25.  
  26. PS: don't forgot to replace my-gmail-id and my-gmail-password in above code. Also, don't forget to remove duplicate keys if you copied settings from above. For example comment following line if there is another sendmail_path : sendmail_path="C:\xampp\mailtodisk\mailtodisk.exe" in the php.ini file
  27.  
  28. Also remember to restart the server using the XAMMP control panel so the changes take effect.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement