This will be a quick tutorial that will show you how to enable e-mail function in PHP on Windows.
What Will You Need?Top
There are few things you need to get before you can continue.
Set Up SendmailTop
After you’ve downloaded sendmail.zip and sendmail-SSL.zip, extract both zip files into same folder and place it somewhere (in my example, location is C:\Program Files\wamp\bin\sendmail). After that open sendmail.ini and change settings like this.
smtp_server=smtp.gmail.com smtp_port=587 smtp_ssl=tls auth_username=(account addres that you created) auth_password=(password of that account)
Change php.iniTop
Open php.ini and find mail function section. There you’ll comment lines that contain SMTP and smtp_port. Then you’ll uncomment line that has sendmail_path and add path to sendmail.exe so you’ll have something like this.
;SMTP = smtp.example.com ;smtp_port = 25 sendmail_path = "C:\Program Files\wamp\bin\sendmail\sendmail.exe"
ConclusionTop
This is a simple way to enable PHP’s mail() function on Windows. I tested this method on Windows 7 but it should work also on XP and Vista. Thank you for reading.
Check yout settings int php.ini and use settings as I did
i hv done same as u suggested , but i can’t get mail
i hv a warning like this
Warning: mail() [function.mail]: Failed to connect to mailserver at “localhost” port 25, verify your “SMTP” and “smtp_port” setting in php.ini
Forgot to mention that I’m running Windows 7 64-bit and installed sendmail on my local IIS.
Works like a charm! Thank you for this tutorial
okay.. this tutorial works for me…
thank you so much dude
Tested on XAMPPLite + Win7 + Gmail SMTP
Hmmm. Really dont know. It works for me. Perhaps you could try it on an other computer
****
DESPERATE HERE – PLEASE HELP OUT!
Can you imagine have done every thing – step by step – and my emails are never delivered.
I’m I doomed???
I would really appreciate some orientation here.
****
Oh, and I forgot to mention.
I get no erro messages, and the code that I’m using to test the mail() function is:
// The message
$message = “Line 1\nLine 2\nLine 3″;
// In case any of our lines are larger than 70 characters, we should use wordwrap()
$message = wordwrap($message, 70);
// Send
mail(‘zootalk@gmail.com’, ‘My Subject’, $message);
Well, there are many tutorials on the Internet that talk about your problem. Just use Google to search something like PHP E-mail system.
An email system . Yes I would like to have a ready made script that will send an Email to a user and his/her email .
Where can I get that.
I know there r paid services but i want to mess about the code myself.
tnx
What do you want to set up? E-mail system? Well, you now know how to enable it and then you can create PHP script or in any other programming language that will pull data from database (or your data storage) and send e-mails
.
Nice tutorial .Ok i have a few thousands of subscribers to my blog and i want to send a newsletters . How can I set up that in my shared server host.
Thanks
Please notify me when u respond to this post by my email, for I do not know when u will check this .
cheers