using php mail() function on localhost w/ xampp

Problems with the Windows version of XAMPP, questions, comments, and anything related.

using php mail() function on localhost w/ xampp

Postby programguru » 28. April 2009 23:05

Hello, :?:

I am just trying to test my php email scripts w/ php mail() before I upload them to my live server, and I wanted to know if anyone can suggest a working tutorial on properly configuring the php.ini to use the mail() function on localhost.

Thank you for a advice :
programguru
 
Posts: 4
Joined: 28. April 2009 23:02

Re: using php mail() function on localhost w/ xampp

Postby Sharley » 29. April 2009 00:50

Now there are different locations for the php.ini file to edit depending on which version of XAMPP you are using - always a good idea to give the XAMPP version and the OS you are using so we can provide a related reply.
User avatar
Sharley
AF Moderator
 
Posts: 3316
Joined: 03. October 2008 05:10
Location: Yeppoon, Australia Time Zone: GMT/UTC+10
Operating System: Win 7 Pro 32bit/XP Pro SP3

Re: using php mail() function on localhost w/ xampp

Postby programguru » 29. April 2009 01:02

Hi Sharley,

Here is the that info: ApacheFriends XAMPP (Basispaket) version 1.6.8

OS: Win XP Home SP2
programguru
 
Posts: 4
Joined: 28. April 2009 23:02

Re: using php mail() function on localhost w/ xampp

Postby Sharley » 29. April 2009 01:18

OK, that really helps.

Open xampp\apache\bin\php.ini file in your text editor and find the section:
Code: Select all
[mail function]
; For Win32 only.
SMTP = localhost
smtp_port = 25

; For Win32 only.
;sendmail_from = me@example.com

; For Unix only.  You may supply arguments as well (default: "sendmail -t -i").
;sendmail_path = "\xampp\sendmail\sendmail.exe -t"

; Force the addition of the specified parameters to be passed as extra parameters
; to the sendmail binary. These parameters will always replace the value of
; the 5th parameter to mail(), even in safe mode.
;mail.force_extra_parameters =
Edit it so it looks like this but replace the red text with your own details usually the same as you use in your email client like OE etc.:
[mail function]
; For Win32 only.
SMTP = mail.myisp.com
smtp_port = 25

; For Win32 only.
sendmail_from = me@myisp.com <-- uncomment this line

; For Unix only. You may supply arguments as well (default: "sendmail -t -i").
;sendmail_path = "\xampp\sendmail\sendmail.exe -t"

; Force the addition of the specified parameters to be passed as extra parameters
; to the sendmail binary. These parameters will always replace the value of
; the 5th parameter to mail(), even in safe mode.
;mail.force_extra_parameters =

Please let me know back if that helped you send your mail via your script.
Thanks.
User avatar
Sharley
AF Moderator
 
Posts: 3316
Joined: 03. October 2008 05:10
Location: Yeppoon, Australia Time Zone: GMT/UTC+10
Operating System: Win 7 Pro 32bit/XP Pro SP3

Re: using php mail() function on localhost w/ xampp

Postby programguru » 29. April 2009 04:40

Sharley,

Thank you for the advice. I will try this, but I am using a test gmail account, and was wondering if the configuration is different or more data is required?
programguru
 
Posts: 4
Joined: 28. April 2009 23:02

Re: using php mail() function on localhost w/ xampp

Postby Sharley » 29. April 2009 04:58

If you are required to provide a username/password combination to access an SMTP server then you can't use the above method.

Instead you would comment out the "for Win32 only" section and uncomment the sendmail_path line.

Then you need to edit the xampp\sendmail\sendmail.ini file with the details required and tell your script to use sendmail in it's configuration.

An advanced XAMPP for Windows forum search for keyword sendmail (or gmail perhaps - 90 posts to look through) will give many post that show the sendmail.ini file edits if you have problems trying to work out what is required.
User avatar
Sharley
AF Moderator
 
Posts: 3316
Joined: 03. October 2008 05:10
Location: Yeppoon, Australia Time Zone: GMT/UTC+10
Operating System: Win 7 Pro 32bit/XP Pro SP3

Re: using php mail() function on localhost w/ xampp

Postby programguru » 29. April 2009 05:06

OK Sharley,

Thanks for your advice. I am going to search the forum for some details on that.
programguru
 
Posts: 4
Joined: 28. April 2009 23:02


Return to XAMPP for Windows

Who is online

Users browsing this forum: No registered users and 45 guests