On 8 Sep 2022, at 02:52, Gary Dale <gary@extremeground.com> wrote:
On 2022-09-07 17:49, Gareth Evans
wrote:
On 7 Sep 2022, at 17:55,
Gary Dale <gary@extremeground.com> wrote:
I'm using a web hosting
company that pretty much limits me to using
PHPMailer on their servers for sending complex
e-mails (e.g. with attachments). That is working.
[...]
However when I try it
with my local Apache2 server, it doesn't work.
[...]
However the test .php
file that works on the hosting company's server
doesn't do anything on my local server. I try to
load the page and get nothing - not even an error
message.
Hi Gary,
If you expect output of some sort from the
script, try putting
ini_set("display_errors",1);
ini_set("error_reporting",E_ALL);
at the top of the script in question - this
should show any errors on the page rather than
having to look in /var/log/syslog, though that might
be worthwhile too.
Also
$ php -l file.php
(Lower case L after dash)
Do you receive any bounce message in (iirc... or
something like...)
/var/spool/mail/username ?
Not knowing whether you expect output, it could
be that the script is working but the remote server
rejects mail from non-routable (ie LAN) IPs - I
don't think a bounce message is necessarily
guaranteed though.
Any difference sending with PHPMailer via SMTP ?
Best wishes,
Gareth
Having said that re bounce messages, I can'tremember if
the error report concerned, if any, may actually be found
in syslog - it's a while since I've seen one as I gave up
testing email from local machines for this reason.
Possibly getting ahead of myself here, but it might
also be worth mentioning greylisting as an issue to be
aware of - particularly for email originating from
non-routable addresses.
"Mail from
unrecognized servers is typically delayed by about 15
minutes, and could be delayed up to a few days for
poorly configured sending systems."
Also does the (working) server run the same OS as your
local machine?
You may need to correct the location of sendmail (or
whatever) in local phpmailer's config
Owner / group / permissions for phpmailer dir + files? I
should have thought of that one first - it's a common PHP "white
screen of death" cause.
Thanks Gareth. I didn't notice your answer because it was in a
different thread. I've been working directly on the remote host
all afternoon until I get the php script doing (mostly) what I
want. When I followed your suggestion, it showed errors relating
to file permissions on a file that I wanted to write to. I changed
them and now its working the same as the remote host.
However, the writing to the file wasn't part of the script in the
morning. It was something I added after I got the script working
on the remote host and wanted to add features. The basic script
was just a test script with everything hardcoded. The one that is
now working is actually driven by an HTML form so just the SMTP
login is hardcoded. The writing to a file was a late addition to
create a cumulative .csv log of submissions. I just needed to
allow the file to be written to to get this later script to work.
Anyway, it looks like the issue has gone away.
Thanks!
I use various email clients which all have a mind of their own when it comes to threads.
Interesting. For future ref, it's not unknown for strange PHP errors or behaviour (on Apache at least) to be solved by a reboot - may be worth trying if all else fails.
Best wishes, Gareth |