XMailforum is a readonly knowledge archive now.

Registering as a new user or answering posts is not possible anymore.

Might the force be with you, to find here what you are looking for.

2019-09-20 - hschneider, Admin

Cookie Disclaimer: This forum uses only essential, anonymous session cookies (xmailforum*), nothing to be scared of.

XMail Forum [Powered by Invision Power Board]
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. smile.gif

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 ...

Our Server:

- 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,

Mario

Posted by: hschneider Apr 28 2004, 09:03 PM
Checkout this one:
http://xmailforum.homelinux.net/index.php?showtopic=1545

Posted by: Nuclear-Ping Apr 28 2004, 11:57 PM
Hi and thanks! smile.gif

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?

Greetings,
Mario

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
"127.0.0.0" "255.255.255.0"
to your smtprelay.tab

Here is my example script:

CODE

<?php
 mail('test@marketmix.com','Test','Just a test');
?>


You can also force sendmail_from directly from your script:

CODE

<?php
 ini_set('sendmail_from','sender@marketmix.com');
 mail('test@marketmix.com','Test','Just a test');
?>

Posted by: Nuclear-Ping Apr 29 2004, 09:16 AM
OK, lol, my fault. wacko.gif

Now it works.

The error was:

in PHP.ini

- 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)

in smtprelay.tab:

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 postmaster@ourdomain.tld in PHP.ini, smtprelay.tab to "127.0.0.0"[TAB]"255.255.255.0"[RETURN], restarted all the stuff and now it works! smile.gif

Thanks alot for the help. smile.gif

Greetings,
Mario

Posted by: hschneider Apr 29 2004, 09:18 AM
Fine! Your're welcome ... cool.gif


---------------------------------------------------------

Additional info:

Make sure, you call mail() like this:

CODE

mail('recipient@domain.com','your_subject',$body,$HEADERS,"-f$FROM");


where $FROM holds the address which should appear in the envelope.
$HEADERS can hold additional headers or can be empty.

Powered by Invision Power Board (http://www.invisionboard.com)
© Invision Power Services (http://www.invisionpower.com)