Page 1 of 1

PHP Mail giving error on Win 10 - 64 bit

PostPosted: 07. July 2017 16:19
by FreeXEnon
I have a fresh install on XAMPP (3.2.2) on a new 64 bit Win 10 box.
When I try to send email through Drupal 7 I get an error.

I set up a test script to see if php mail is working:

Code: Select all
        $to        = "test@domain.com";
        $subject    = "Test mail";
        $message    = "Hello! This is a simple email message.";
        $from       = "TestEmail@FX-Email-Test-Script.com";
        $headers    = "From:" . $from;

        mail($to,$subject,$message,$headers);
        echo "Mail Sent!";


... and I receive the following error:

Code: Select all
Warning: 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\site\mail_test.php on line 8


My php.ini settings are as follows:

Code: Select all
[mail function]
; For Win32 only.
; http://php.net/smtp
SMTP = localhost
; http://php.net/smtp-port
smtp_port = 25


In all the times I have used XAMPP I have never had an issue with this.

How do I make php mail work on Win 10 64 bit ?

Thanks!

Re: PHP Mail giving error on Win 10 - 64 bit

PostPosted: 07. July 2017 18:04
by Nobbie
You have to setup and configure a full featured SMTP Mail server on your PC. Before you try to setup Mercury or any other server, read this thread: viewtopic.php?f=16&t=75749

Re: PHP Mail giving error on Win 10 - 64 bit

PostPosted: 07. July 2017 18:06
by FreeXEnon
What is curious to me is that I have not had to do that before when working with XAMPP.
Why is it different here that requires me to do that?

Re: PHP Mail giving error on Win 10 - 64 bit

PostPosted: 25. July 2017 17:41
by FreeXEnon
So, no one knows why this has changed?
I have never had to setup anything different on this or any of my ISP's, the default php mail has always worked until now.

I do not want to add a username and password for a service. It should just send email through php.

Anyone have a clue?

Re: PHP Mail giving error on Win 10 - 64 bit

PostPosted: 26. July 2017 01:44
by Nobbie
FreeXEnon wrote:I have never had to setup anything different on this or any of my ISP's, the default php mail has always worked until now.


Of course, as your ISP provides a fully featured webspace including a SMTP mailserver registered to your hosted domain.

FreeXEnon wrote:I do not want to add a username and password for a service. It should just send email through php.

Anyone have a clue?


PHP cannot just send emails, it requires an SMTP server as i already said.

Re: PHP Mail giving error on Win 10 - 64 bit

PostPosted: 26. July 2017 17:06
by FreeXEnon
Alrighty!
I got it setup, thanks!