Page 1 of 1

smtp mail and php form

PostPosted: 20. January 2005 04:31
by swgipson
Hi!
I just installed xampp on my laptop so I can demonstrate offline to clients. I have a php form in a folder in the htdocs. If I test the form I get this error.

Warning: mail() [function.mail]: Failed to connect to mailserver at "localhost" port 25, verify your "SMTP" and "smtp_port" setting in php.ini or use ini_set() in C:\apachefriends\xampp\htdocs\midamericatest\businessthankyou.php on line 37


My php code is working on a real hosting server online. How can I get it to work? I also turned off my firewall and still received the error.

Thanks!!!

Sharon

PostPosted: 20. January 2005 17:23
by taustin
Do you have a mail server running on the laptop?

PostPosted: 20. January 2005 17:48
by swgipson
There is Mercury mail that is included with the xampp install. Other than that no.

Sharon

PostPosted: 21. January 2005 12:07
by Maller
Just use the smtp server supplied by your ISP

PostPosted: 21. January 2005 12:34
by elkodesign
Check your php.ini file and adjust the following section to your specifications.

Code: Select all
[mail function]
; For Win32 only.
SMTP = smtp.yourprovider.com

; For Win32 only.
sendmail_from = yourname@email.com

PostPosted: 21. January 2005 15:52
by swgipson
Okay that worked thanks! What if I want to test though and i'm not online. Would I need to installl something?

Sharon

PostPosted: 21. January 2005 17:32
by taustin
You can run Mercury and set php.ini to localhost. You'll have to set up a fake domain, and at least one local user, in Mercury, and start it manually when you need it.

PostPosted: 21. January 2005 17:45
by swgipson
You can run Mercury and set php.ini to localhost. You'll have to set up a fake domain, and at least one local user, in Mercury, and start it manually when you need it.

How do I set up a fake domain? I figured out how to start it. It does have a test user.

PostPosted: 21. January 2005 22:10
by taustin
In the Configuration menu, go to Mercury Core Module, and go to the Local Domains tab. There's probably something there already, if only "localhost." Just make sure any email you send is addressed to a valid address (like the test user) in that domain, so something like testuser@localhost. Mercury should accept it at that point.

PostPosted: 22. January 2005 00:23
by swgipson
Okay, I changed the e-mail address in the form to postmaster@localhost I didn't get any errors and it was sent. Now to figure out how to read postmaster inbox or where it is located in Mercury?

Thanks!!!

Sharon

PostPosted: 22. January 2005 01:40
by taustin
You can run a normal email client, like Outlook Express. The server name would be localhost, the user name and password whatever they are for the account.

You can also look at it directly in Explorer. Mercury is installed in

c:\apachefriends\xampp\mercurymail

The email would be in

c:\apachefriends\xampp\mercurymail\mail, with each user having a directory named after their user name.

Or you could install a webmail client (since xampp is a web server), and check it that way. I would presently recommend IlohaMail from http://ilohamail.org/ Very simple to set up and get running.

PostPosted: 22. January 2005 02:26
by swgipson
okay, I set it up in outlook express with incoming and outgoing servers localhost. I didn't get any errors but after I sent the form it didn't pull it in.

I have this in my php.ini file

[mail function]
; For Win32 only.
SMTP = localhost

; For Win32 only.
sendmail_from = postmaster@localhost

is this correct?

I had changed it earlier so I can't remember what it was set to before.

Sharon

PostPosted: 22. January 2005 09:27
by taustin
The sendmail_from address shouldn't matter if it is going to a valid local address.

The only thing that comes to mind is check the Mercury log, or turn on session logs to see what's actually happening.

PostPosted: 22. January 2005 16:10
by swgipson
This is what is in the Mercury log

T 20050122 090704 41f214b3 MAIL FROM:<postmaster@localhost>
T 20050122 090704 41f214b3 RCPT TO:<postmaster@localhost>
T 20050122 090704 41f214b3 DATA - 16 lines, 350 bytes.
T 20050122 090705 41f214b3 QUIT
T 20050122 090705 41f214b3 Connection closed with 127.0.0.1, 1 sec. elapsed.


Sharon

PostPosted: 04. February 2005 18:15
by taustin
swgipson wrote:This is what is in the Mercury log

T 20050122 090704 41f214b3 MAIL FROM:<postmaster@localhost>
T 20050122 090704 41f214b3 RCPT TO:<postmaster@localhost>
T 20050122 090704 41f214b3 DATA - 16 lines, 350 bytes.
T 20050122 090705 41f214b3 QUIT
T 20050122 090705 41f214b3 Connection closed with 127.0.0.1, 1 sec. elapsed.


Says it was sent successfully. Look in the mercury\mail\postmaster\ folder and see if there's anything there other than the password file. Also, look in the mercury\queue folder and see if there anything at all in there. If there's a problem with delivery, that's where it will hang.

Sometimes, Mercury gets . . . confused about where account folders go. Go to the Manage Local Users screen, and see if any accounts show up there. If they do, add a new one, and see if a folder with the same name shows up in the \mercury\mail\ folder.

(Sorry it took a while to respond. Been out of town for a funeral.)