|Printable Version of Topic
Click here to view this topic in its original format
|XMail Forum > Documentation and Knowledge Base > Problems sending with PHP mail()|
|Posted by: Nuclear-Ping Apr 28 2004, 08:49 PM|
| Hi all,
I'm new to XMail and was able to successfully set it up the last 5 hours and it works now very very good, SMTP with SMTP-Auth and POP do their service fine.
But the only problem I have left is that I cannot send mails using the PHP mail () function. It tells me no error but also no mails ever arrive. I already used the XQM, the que is empty and all other Mails I sent (for example with Outlook) arrive immediately and when I send mails to the server they also arrive immediately. But PHP loose them somewhere ... somehow ...
- Windows 2000 Server
- Apache 2.0.48
- PHP 4.3.6
- XMail 1.18
Before recovering XMail I was running IIS HTTP and IIS SMTP Server on the machine (but had Apache installed long before) and sending mails with PHP mail () was no problem there.
What can I do?
I already searched around and read related topics, but found no solution. Configuration seems to be OK since all other things work well and I don't want to use the SMTP-class hschneider provided in one posting, because there are several things hosted on the server which just cannot be changed since they do not belong to us.
Thanks in advance,
|Posted by: hschneider Apr 28 2004, 09:03 PM|
| Checkout this one:
|Posted by: Nuclear-Ping Apr 28 2004, 11:57 PM|
| Hi and thanks!
Yes, I already did. Thats why I said "... I don't want to use the SMTP-class hschneider provided in one posting ..."
Sorry, but this thread was no solution for me, since I cannot just replace existing codes which are owned by customers with the SMTP-Class.
Isn't there a plain solution just without using 3rd Party PHP Code? I mean, using IIS' SMTP worked without any problems providing localhost as SMTP Server in the PHP.INI. It also must / should be possible with XMail, shouldn't it?
|Posted by: hschneider Apr 29 2004, 07:09 AM|
| Sorry - been reading too fast ..
Can you post me some example script + your php.ini ?
|Posted by: hschneider Apr 29 2004, 07:27 AM|
| Just checked it out on my machine (WinXP + XMail 1.18 + PHP4.3.4): works without any problems.
Make sure that 'sendmail_from' is set to a valid value in your PHP.ini. It's default is postmaster@localhost, which is rejected by most recipient servers, because RDNS lookups fail.
Further pls make sure, that the machine on which your script is executed, is allowed to relay without SMTP auth. This requires an entry in smtprelay.tab. Have again a look at your php.ini. If SMTP is e.g. set to localhost, you need to add
to your smtprelay.tab
Here is my example script:
You can also force sendmail_from directly from your script:
|Posted by: Nuclear-Ping Apr 29 2004, 09:16 AM|
| OK, lol, my fault.
Now it works.
The error was:
- SMTP was not set to localhost but to the inet hostname of server, I changed it when trying to find the error
- send_from was not set to a valid host (fictive host), because IIS didn't care about this (wasn't configured to)
I once tryed this combination, but with "127.0.0.1"[TAB]"255.255.255.0"[RETURN], but that didn't work, because PHP was still not configured correctly.
Now I set SMTP to localhost and send_from to email@example.com in PHP.ini, smtprelay.tab to "127.0.0.0"[TAB]"255.255.255.0"[RETURN], restarted all the stuff and now it works!
Thanks alot for the help.
|Posted by: hschneider Apr 29 2004, 09:18 AM|
| Fine! Your're welcome ...
Make sure, you call mail() like this:
where $FROM holds the address which should appear in the envelope.
$HEADERS can hold additional headers or can be empty.