Enable Send Email in XAMPP (localhost)

Sangwan Pankaj Reply 11:27
In this tutorial, i will share how to send Email from XAMPP (PHP). i use XAMPP 1.8.1 version .This has been tested by me and it worked.

Lets start:-
first always make a backup before changing any code in core/configuration files.
then

Edit your php.ini in - “xampp\php\php.ini”

Before Changes:- 
---------------------------
[mail function]
; For Win32 only.
; http://php.net/smtp
SMTP = localhost
; http://php.net/smtp-port
smtp_port = 25

; For Win32 only.
; http://php.net/sendmail-from
;sendmail_from = postmaster@localhost

; XAMPP IMPORTANT NOTE (1): If XAMPP is installed in a base directory with spaces (e.g. c:\program filesD:\xampp) fakemail and mailtodisk do not work correctly.
; XAMPP IMPORTANT NOTE (2): In this case please copy the sendmail or mailtodisk folder in your root folder (e.g. C:\sendmail) and use this for sendmail_path.

; XAMPP: Comment out this if you want to work with fakemail for forwarding to your mailbox (sendmail.exe in the sendmail folder)
;sendmail_path = "\"\XAMPP\sendmail\sendmail.exe\" -t"

After Changes :-
-----------------------
[mail function]
; For Win32 only.
; http://php.net/smtp
SMTP = smtp.gmail.com
; http://php.net/smtp-port
smtp_port = 587

; For Win32 only.
; http://php.net/sendmail-from
sendmail_from = yourgmailid@gmail.com

; XAMPP IMPORTANT NOTE (1): If XAMPP is installed in a base directory with spaces (e.g. c:\program filesD:\xampp) fakemail and mailtodisk do not work correctly.
; XAMPP IMPORTANT NOTE (2): In this case please copy the sendmail or mailtodisk folder in your root folder (e.g. C:\sendmail) and use this for sendmail_path.

; XAMPP: Comment out this if you want to work with fakemail for forwarding to your mailbox (sendmail.exe in the sendmail folder)
sendmail_path = "\"\XAMPP\sendmail\sendmail.exe\" -t"

now

Edit your sendmail.ini - “xampp\sendmail\sendmail.ini”

smtp_server=mail.mydomain.com or smtp_server=localhost

; smtp port (normally 25)
smtp_port=25

comment these two lines using - ;


;smtp_server=mail.mydomain.com or ;smtp_server=localhost
; smtp port (normally 25)

;smtp_port=25



and add some extra code in the bottom of your sendmail,ini:

;new config:
smtp_server=smtp.gmail.com
smtp_port=587
smtp_ssl=tls
error_logfile=error.log
pop3_server=
pop3_username=
pop3_password=
force_recipient=
hostname=
auth_username=yourgmailid@gmail.com
auth_password=your gmail password
force_sender=yourgmailid@gmail.com

NOTE: 
  1. You Need to restart xampp after saving both files.
  2. Change yourgmailid@gmail.com & your gmail password  with your own email id and password
  3. You Need to enable SMTP in your GMail to make this work and all sender will be from your email (if need).





Related Posts

xampp 7632724494265066208
Copyright by GhostPHP. Powered by Blogger.

Search

Recent Post

Popular Posts

Follow us