user3414896
user3414896

Reputation: 1

WAMP setup to send mails locally

I want my script to be able to send emails from WAMP to mail services such as yahoo,gmail etc.I heard that gmail has an SMTP to do that, i dont know how to setup my WAMP to do that.Below are my files HTML sample code file: http://pastebin.com/e50wt0u0 sendmail.php: http://pastebin.com/8iTga04Y

Upvotes: 0

Views: 431

Answers (1)

Abhishek
Abhishek

Reputation: 567

You can send mail from localhost with sendmail package , sendmail package is provided with XAMPP by default. So if you are using XAMPP then you can easily send mail from localhost.

For example you can configure C:\xampp\php\php.ini and c:\xampp\sendmail\sendmail.ini for gmail to send mail.

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.

In php.ini file find [mail function] and change

SMTP=smtp.gmail.com
smtp_port=587
sendmail_from = [email protected]
sendmail_path = "\"C:\xampp\sendmail\sendmail.exe\" -t"

Now Open C:\xampp\sendmail\sendmail.ini. Replace all the existing code in sendmail.ini with following code

[sendmail]

smtp_server=smtp.gmail.com
smtp_port=587
error_logfile=error.log
debug_logfile=debug.log
[email protected]
auth_password=my-gmail-password
[email protected]

Now you are done!! create php file with mail function and send mail from localhost.

PS: don't forgot to replace my-gmail-id and my-gmail-password in above code with your id and password. 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

Upvotes: 3

Related Questions