php mail not working with localhost

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

php mail not working with localhost

Postby BoratSagdiyev » 04. March 2008 02:37

I'm having the same problem many others are having:

Failed to connect to mailserver at "localhost" port 25, verify your "SMTP" and "smtp_port" setting in php.ini

Here is part of my php.ini:
[mail function]
; For Win32 only.
SMTP = localhost
smtp_port = 25

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

Is there something I need to fix here to be able to get my web form to email me?
I apologize if this has been answered before, I searched earlier posts but may not have understood the answer since I don't really understand mail servers. Thanks in advance.
BoratSagdiyev
 
Posts: 14
Joined: 28. November 2007 04:54

Re: php mail not working with localhost

Postby Milligan » 04. March 2008 03:10

Last edited by Milligan on 17. July 2008 06:28, edited 1 time in total.
Milligan
 
Posts: 136
Joined: 03. March 2008 06:23

Postby Scory » 04. March 2008 11:54

If you supply a remote SMTP Server, be sure that no login is required for sending mails. Most (nearly every) provider do not offer SMTP without login.

You should not use the poor PHP mail() function, but use the phpmailer instead (download at phpmailer.sourceforge.net). This works without any needs to configure php.ini and it supports SMTP login as well as HTML mails, attachments and so on.
Scory
 

Postby Milligan » 04. March 2008 12:24

Last edited by Milligan on 17. July 2008 06:24, edited 1 time in total.
Milligan
 
Posts: 136
Joined: 03. March 2008 06:23

Postby Scory » 04. March 2008 12:42

Milligan wrote:No need to download anything, you can use the fake sendmail included with xampp and add your email login information in the sendmail.ini file.


Still not the best solution (same problem as Mercury Server etc.): if you use your own SMTP relay and send mails directly, many large email providers (like web.de and gmx.de) are blocking incoming mails from "private" IPs (for SPAM reasons).

I just tested that scenario on my home pc and had lot of troubles with GMX.

Regards
Scory
Scory
 

Postby Milligan » 04. March 2008 12:50

Last edited by Milligan on 17. July 2008 06:30, edited 1 time in total.
Milligan
 
Posts: 136
Joined: 03. March 2008 06:23

Postby Scory » 04. March 2008 13:37

It does not depend on YOUR configuration. It depends on GMX.

Maybe you have no experience with GMX.DE (or WEB.DE), as these are german mail providers. They won't accept mails from your local PC. No way.
Scory
 

Postby Milligan » 04. March 2008 14:16

Last edited by Milligan on 17. July 2008 06:24, edited 2 times in total.
Milligan
 
Posts: 136
Joined: 03. March 2008 06:23

Postby BoratSagdiyev » 09. March 2008 01:07

Thanks for responding. I changed the smtp_server to my isp's in the php.ini and sendmail.ini files. Unfortunately 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:\xampp\htdocs\emailMe.php on line 11

I don't know why it is trying to connect to localhost when I specified my isp's mailserver.

Is the smtp_server the only field I need to change?
BoratSagdiyev
 
Posts: 14
Joined: 28. November 2007 04:54

Postby Milligan » 09. March 2008 01:22

Last edited by Milligan on 17. July 2008 06:21, edited 1 time in total.
Milligan
 
Posts: 136
Joined: 03. March 2008 06:23

Postby BoratSagdiyev » 09. March 2008 04:06

Thank you so much, it worked! I updated the wrong php.ini file. I'm impressed by your knowledge of xampp, would you care to share some of the links that helped you when you were learning this stuff?
BoratSagdiyev
 
Posts: 14
Joined: 28. November 2007 04:54

Re: php mail not working with localhost

Postby Greekgig » 22. December 2011 15:25

what was the link? all i see excuse the irony but yeah all i see is blank
Greekgig
 
Posts: 1
Joined: 22. December 2011 14:15
Operating System: windows 7

Re: php mail not working with localhost

Postby Sharley » 22. December 2011 15:35

This is a very old topic and would probably no longer be relevant anyway.

Perhaps you could start a new topic with your own mail issues so that we may be able to offer a solution.

Best wishes. :)
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


Return to XAMPP for Windows

Who is online

Users browsing this forum: No registered users and 54 guests