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

 

Share this post


Link to post
Share on other sites

Hey Paul. I'd love to help here, but I don't use Windows much and I pretty much never worry about sending email from localhost, so I'm no good on this subject. Hopefully someone else will have some ideas. 

Share this post


Link to post
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

Share this post


Link to post
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.

Share this post


Link to post
Share on other sites

As mentioned in previous post, the continuous high server load caused another issue that PHP mail function in Wordpress failed to work, not very sure why does this occur maybe some timeout settings of PHP mail?

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×