Jump to content
Larry Ullman's Book Forums

Recommended Posts

Hi all,
I've written the following very simple piece of code.

<?php

echo'
<h1>Your emails</h1>
';

$to = 'demoPHP@localhost.com';

$subject = 'Email testing';

$message = 'test';

mail($to, $subject, $message);

?>

The email doesn't arrive in Thunderbird using Mercury Mail in XAMPP on Windows.

 

The text 'Your emails' appears in the browser so I know the file is being processed by PHP.

I can send an email using Thunderbird from 'demoPHP@localhost.com' to 'demoPHP@localhost.com' and it arrives in the inbox OK, so I know that Mercury is configured OK in that it's sending emails.

I've changed the php.ini file to the following:

 

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

; For Win32 only.
; http://php.net/sendmail-from
;sendmail_from = postmaster@localhost.com

 

Does anyone have any ideas what I'm doing wrong. I'm actually running a Windows 64bit system. Would that make any difference? I'm referring to the fact that the php.ini file refers to 'Win32'.

 

Thanks

Paul

 

Link to comment
Share on other sites

No problem Larry.

 

However, if you don't use localhost to test your email coding what do you use?

 

My 'plan B' was to upload the code to a stand-alone page on my own live site and test it there. Obviously a bit more of a phaff because there's more chance of me winning a Nobel prize for PHP coding than my code working first time which means going backwards and forwards with FTPs.

 

Cheers

Paul

Link to comment
Share on other sites

I don't test my email stuff until it's on the live site, normally. Sending out an email from a live server pretty much never has problems. So I'll make sure everything else is working and then make sure the email sending is working as my last rounds of tests on my live server.

Link to comment
Share on other sites

  • 3 years later...
 Share

×
×
  • Create New...