Forum Moderators: coopster

Message Too Old, No Replies

mail config on unix

sure its right, but not working

         

bluedalmatian

5:58 pm on Apr 18, 2005 (gmt 0)

10+ Year Member



I've got Exim installed and I can send emails ok through that from the command line.

I've also got the following in my php.ini file:

sendmail_path = /usr/local/exim/bin/exim

yet the mail() function continues to return false each time.

have I missed something out>

thanks

Spudstr

7:13 pm on Apr 18, 2005 (gmt 0)

10+ Year Member



does the mail log display anything? sometimes the user that the script is being ran as can access the mail script...

jatar_k

8:01 pm on Apr 18, 2005 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



also take a look at phpinfo [php.net] and see if everything looks ok there and have a read through the mail page [php.net]

bluedalmatian

9:08 pm on Apr 18, 2005 (gmt 0)

10+ Year Member



The mail server log isnt showing anything at all so obviously its not receiving the request.

phpinfo() shows sendmail_path as being set correctly, but theres not really any other mail related info there.

coopster

11:09 am on Apr 19, 2005 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



From the link jk provided on mail():

For the Mail functions to be available, PHP must have access to the sendmail binary on your system during compile time. If you use another mail program, such as qmail or postfix, be sure to use the appropriate sendmail wrappers that come with them.

There is only one user-contributed note on exim and I'm not sure if it is going to be helpful to you or not...

bluedalmatian

4:27 pm on Apr 19, 2005 (gmt 0)

10+ Year Member



Yes the orginal sendmail was there at compile time, and Ive recompiled it since. There is a sym link in the two usual sendmail locations which points to exim.

I've also checked that the user httpd has permission to access exim and it can.

I compiled it as root so there wouldn;t have been an access permission issue there.

bluedalmatian

5:07 pm on Apr 19, 2005 (gmt 0)

10+ Year Member



When I'm compiling it, theres nothing extra I need to include on ./configure is there to make it enable mail?

I'm sure its detecting exim/sendmail properly at build time because I'm led to beleive otherwise you get an error when you call mail() saying that the function isnt supported.

coopster

11:08 am on Apr 21, 2005 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



No, not according to the installation notes for mail(), anyway.

I would have to follow jk's advice then at this point and head back to the logs. If php is firing it off without error, something should at least be showing up in your logs or in the queue.

bluedalmatian

1:46 pm on Apr 21, 2005 (gmt 0)

10+ Year Member



If php is firing it off without error, something should at least be showing up in your logs or in the queue.

Yes, unless PHP "cant find" exim. Which is what I think's happening here even though sendmail_path is set.

Otherwise exim would at least have something in its log saying that a send request was initiated.

Remember that mail() is returning false. If it was returning true then exim would be accepting the message and the fault must lie there somewhere, but false means exim wouldnt accept the message, and as exim has no record of it, it must also mean it was never passed the message. Surely?

Unless of course....PHP is calling exim with some incorrect syntax.

If I do that on the command line exim just spits out a useage msg and termiates with nothing in the log. Mybe thats whats happening, but if so Ive no idea how to find out. Stupidly there seems to be no way of extracting more detailed error info out of the mail function result, like you can with the database functions.

UPDATE!

It IS calling exim. By very quick keystroke work I caught it with the ps command wilst the php page was loading. Ummm...

bluedalmatian

8:14 pm on Apr 21, 2005 (gmt 0)

10+ Year Member



Exim must be objecting to the syntax php is calling it with. -t -i i think is the default callingiit like that manually doesnt casue a problem so i dont know.

its a pity all the books out there only cover php programming. there seems to be very little info on configuring the damn thing.

bluedalmatian

8:19 pm on Apr 27, 2005 (gmt 0)

10+ Year Member



It's the -i option that PHP uses to call sendmail by default.

-i tells sendmail or exim that PHP will not use a . on its own line to indicate the end of the message but will indicate it someother way.

Anyone know how?!

This is the problem. Exim is sitting there waiting for more input.

jatar_k

9:13 pm on Apr 27, 2005 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



you could actually use a function to do this instead of mail using the contributed note on the mail page that uses popen [php.net]

I use this with sendmail as well, easier and faster sometimes though it requires a little programming.

bluedalmatian

9:51 pm on Apr 27, 2005 (gmt 0)

10+ Year Member



sometimes though it requires a little programming

Yes, it would not only require me to modify all my scripts but also if anyone else uploads their scripts to the server I'd have to make sure they did it a special way as well.

surely it must be possible to do it using the standard mail function?

does the -i option take an argument stating what the end of message deliminator is? i'll have to look it up, the exim documentation doesnt mention it, i'll look it up for sendmail, but i dont have my sendmail book here so, if anyone happens to know the anwer off the top of their head I'd be grateful if you could post it.

ta.

jatar_k

10:03 pm on Apr 27, 2005 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



I looked around for the answer what a terrible thing to have to search for, I get mostly garbage results and couldn't find anything really will look again when I have a chance

I do have one question, why not use sendmail or qmail? why exim?

not trying to be difficult, just wondering.

bluedalmatian

10:07 pm on Apr 27, 2005 (gmt 0)

10+ Year Member



SORTED COMPLETETLY!

Before, I forced it not to use -i, by specifying the other arguments manually (goodness knows what you do if you dont want it to use any arguments?!)

And then appended \n. to the end of the message body, which worked. Thats how I knew it was -i causing the problem. It just occured to me maybe if -i isn't specified \n. isnt needed and it will automatically use the end of string as the end of message indicator - AND IT DID!

So for the record here's the solution:
Dont let PHP call exim with the default options, manaully tell it like this:
sendmail_path = /path/to/exim -t

Thanks everyone for your help and suggestions!

jatar_k

10:57 pm on Apr 27, 2005 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



glad you got it sorted bluedalmatian