I am developing some PHP code for a client and part of the code must send emails. My development environment is using Eclipse on Windows. I want to test the email functionality from my local machine. I have to set the values in php.ini file but I am not sure how to specify all the settings. I understand that I must use a SMTP server and have one that run on my website which runs on Linux. I can copy all my code there and let that send to my email to test it.

The available settings in my php.ini file is as follows:

; For Win32 only.
SMTP = localhost
smtp_port = 25

; For Win32 only.
sendmail_from = webtest@localhost

My question is this: Can I change the settings in the php.ini file to use the smtp server on my website to send the mail from my localhost via the smtp server on my website? If I can do this then how do I specify the username and password in the php.ini that must be used to log into my smtp server and send the mail?

Thank you.

8 Years
Discussion Span
Last Post by PeterYpenburg

Hi Peter,
you could use your webhosting's SMTP server but PHP doesn't support SMTP authentication out of the box. You have two options:
a) Either you will use your Internet provider's SMTP server (your home/work ISP) because then I believe you won't have to use SMTP authentication (authentication is usually done by your IP address)
b) or you will use a library like XPertMailer http://www.xpertmailer.com/ instead of PHP built-in function mail(). Then you will be able to use SMTP authentication and a SMTP server of your choice.

Let me know if you need any more details.


Hi Petr Pavel,

Thank you for the feedback, I will check out the XPertMailer you suggested.


This question has already been answered. Start a new discussion instead.
Be sure to adhere to our posting rules.