php send mail and xampp

doctorbill
doctorbill used Ask the Experts™
on
I have been using xampp for some time and sending mail from php pages has been working fine (just using the inbuilt mail php functionality)
I am using a local website on windows
I have recently upgraded to windows 10 and mail no longer sends from my computer

Can someone please suggest where I need to check
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Gaurav SinghSolutions Architect

Commented:
first check if you are able to telnet the port 25
Dave BaldwinFixer of Problems
Most Valuable Expert 2014
Commented:
just using the inbuilt mail php functionality
The PHP mail() command requires a SMTP server somewhere to send mail.  It does not do it by itself.  Look at your 'php.ini' and see where your PHP mail() command has been sending to.
Dave HoweSoftware and Hardware Engineer

Commented:
xampp supplies a mail provider that php uses; I would therefore suspect the win10 firewall is blocking that component - will check tonight if nobody else supplies a solution before then :D
Announcing the Winners!

The results are in for the 15th Annual Expert Awards! Congratulations to the winners, and thank you to everyone who participated in the nominations. We are so grateful for the valuable contributions experts make on a daily basis. Click to read more about this year’s recipients!

Author

Commented:
I have checked the php.ini and sendmail.ini settings
These are exactly the same as they were
Software and Hardware Engineer
Commented:
Ok, just tried it here and got "This app can't run on your PC" for the sendmail.exe under Win10 X64. That isn't good :(
Dave HoweSoftware and Hardware Engineer
Commented:
OK, try this.
rename sendmail.exe in your xampp/sendmail/ dir to something else, and download msmtp - copy msmtp.exe into /xampp/sendmail/ and rename to sendmail.exe

Now, you will need to configure that. the config file is (confusingly) c:\ProgramData\msmtprc.txt and should have contents as follows (use the below as a template):

host <hostname for mail server to send to>
port <port of mailserver to send to, probably 25>
user <username to log into mailserver>
password <password for above>
domain <name of YOUR server when talking to mailserver>
from <from email address for mail you send>
tls
tls_starttls
tls_certcheck off

Open in new window


replace everything in <> with the real values, removing the <> as well.

that works here, so give it a try. if it is showing issues for you, try the following. Build a "test.txt" file in /xampp/sendmail with the following contents:
To: <your email address>
Subject: Test Email

This is a test email

Open in new window

then open a command prompt, change directory to the /xampp/sendmail dir, and type the following:

type test.txt | sendmail.exe -t

Open in new window


that should show any errors the mail client is generating.
Dave BaldwinFixer of Problems
Most Valuable Expert 2014
Commented:

Author

Commented:
Re this config file:
Do I need to use : after the variable names?

ie. host: smtp.demon.co.uk
or do I just use:
host smtp.demon.co.uk

Author

Commented:
Also what do I put here as I am sending from a local host:

domain <name of YOUR server when talking to mailserver>
Dave HoweSoftware and Hardware Engineer
Commented:
no colons, and domain (at least with demon) will be your demon domain. so, assuming you are bill@customer.demon.co.uk:

host smtp.demon.co.uk
port 587
user customer
password ******
domain customer.demon.co.uk
from bill@customer.demon.co.uk
tls
tls_starttls
tls_certcheck off

Open in new window

Author

Commented:
I am still unsure of the Domain

My smtp server is smtp.demon.co.uk
username is info@ticktockit.net

Author

Commented:
I have tried this:
-----------
host smtp.demon.co.uk
port 465
user info@ticktockit.net
password ***********
domain ticktockit.net
from info@ticktockit.net
tls
tls_starttls
tls_certcheck off
----------------

The webpage just hangs

Author

Commented:
If I try running the test.txt command, again the system just sits there - no progress

Author

Commented:
The result of the above test:
sendmail.exe: the server sent an empty reply
sendmail.exe: could not send mail (account default from C:\ProgramData\msmtprc.txt)

Author

Commented:
This is my current msmtprc file:

host smtp.demon.co.uk
port 465
user info@ticktockit.net
password ************ (blanked for security)
domain ticktockit.net
from info@ticktockit.net
tls
tls_starttls
tls_certcheck off
Dave HoweSoftware and Hardware Engineer
Commented:
Config looks good; I have tested against smtp.demon.net myself and it works consistently, once I have authed it though the Windows 10 firewall. Check the config of that firewall to make sure it isn't blocking?

Author

Commented:
I have allowed port 465 and sendmail.exe through the firewall
Have I missed anything ?
Dave HoweSoftware and Hardware Engineer
Commented:
not that I can think of. can you use the same credentials in (say) thunderbird, to the same port?

Author

Commented:
Something else I have found:

If I do the following:
telnet localhost 888
I get a connection to my local xampp servver port

If I do:
telnet localhost 465
telnet localhost 25
There is no response
Dave HoweSoftware and Hardware Engineer
Commented:
ports open on apache (under xampp) should be configured as apache "listen" lines in the config. localhost 465 or 25 shouldn't respond, so that is correct (the port is at demon, not on the xampp server)

Author

Commented:
That makes sense - I was not thinking correctly
Basically I am all out of ideas
Dave HoweSoftware and Hardware Engineer
Commented:
Well, the tool works here on windows 10, so next step is to see if you can get to the demon mail server from another mail client, which is why I suggested Thunderbird. The Openssl binary from the apache bin dir could also be used, but thunderbird is a lot easier :D

Author

Commented:
I use outlook 2013 which works fine
Dave HoweSoftware and Hardware Engineer
Commented:
from that machine, with the same smtp host, username, and password settings?

Author

Commented:
Yes - exactly the same

Author

Commented:
Still searchin !

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial