Problems with PHP mail function.

Thread Solved

Join Date: Aug 2006
Posts: 999
Reputation: EnderX is an unknown quantity at this point 
Solved Threads: 1
EnderX EnderX is offline Offline
Posting Shark

Problems with PHP mail function.

 
0
  #1
Aug 28th, 2006
I am attempting to track and record information in a specific php file used where I work. The file is not my own work originally; I inherited it from my predecessor in the position. I am somewhat familiar with PHP, but not an expert. Additionally, I am still a newcomer to Linux work, and the file in question is running on the Suse 9 distribution.

I have modified the file with a simple check at the end to mark certain predefined limits for my tracking purposes. When the file's output goes past these limits, the file is supposed to email me, letting me know what has happened.

I know about the mail() function; I found out about it shortly after I began working on this program. The problem is, it doesn't seem to want to work for me. I am not sure that this is a php problem; the php mail() call always returns a true for me when I test it. However, I have tested microvariations on the mail call (mostly differing echo statements so I'll know it has processed correctly), but have not yet received any of the messages I have been attempting to send myself. Considering I've sent about three dozen by now, over the course of a ~3hr span, I suspect something is happening to prevent them from reaching the internet and being sent.

Does anyone know of any reason that the information sent by the mail function might not be going anywhere?

I recognize, since I am constantly getting 'true' results, that this might not be a php problem. If it is not; if this sounds like it might be a problem with the OS instead, I respectfully request that this message be moved to the correct forum.

Thanks in advance,
-EnderX
Reply With Quote Quick reply to this message  
Join Date: Aug 2006
Posts: 32
Reputation: StatiX is an unknown quantity at this point 
Solved Threads: 2
StatiX's Avatar
StatiX StatiX is offline Offline
Light Poster

Re: Problems with PHP mail function.

 
0
  #2
Aug 28th, 2006
I had the same problem once, I could never get the mail() function to work. Turn out after a few hours I thought about checking my spam filter, and seeing all the emails that had actually worked but were caught at my ISP. A definite DUH for me, I now always check it.

And if thats not your case, and the server is local to you, try and send the mail to yourself@localhost and see if maybe network problems are causing it not to send or filters stopping it. You can also check the php.ini file for sendmail settings. Maybe they are wrong

StatiX
Reply With Quote Quick reply to this message  
Join Date: Aug 2006
Posts: 999
Reputation: EnderX is an unknown quantity at this point 
Solved Threads: 1
EnderX EnderX is offline Offline
Posting Shark

Re: Problems with PHP mail function.

 
0
  #3
Aug 28th, 2006
Thank you for your advice. I'll look into that. I suspect it's not the spam filters, though; I've tried sending to both my work account and my personal account and neither one got through.

What should the settings in php.ini look like? I'd like to make sure of those asap.
Reply With Quote Quick reply to this message  
Join Date: Aug 2006
Posts: 32
Reputation: StatiX is an unknown quantity at this point 
Solved Threads: 2
StatiX's Avatar
StatiX StatiX is offline Offline
Light Poster

Re: Problems with PHP mail function.

 
0
  #4
Aug 28th, 2006
I don't have a unix box handy, just windows but this is what you would need to look at:
*****************************************
  1. [mail function]
  2. ; For Win32 only.
  3. SMTP = localhost
  4. smtp_port = 25
  5.  
  6. ; For Win32 only.
  7. ;sendmail_from = me@example.com
  8.  
  9. ; For Unix only. You may supply arguments as well (default: "sendmail -t -i").
  10. ;sendmail_path = "C:\Program Files\xampp\sendmail\sendmail.exe -t"
  11.  
  12. ; Force the addition of the specified parameters to be passed as extra parameters
  13. ; to the sendmail binary. These parameters will always replace the value of
  14. ; the 5th parameter to mail(), even in safe mode.
  15. ;mail.force_extra_parameters =

This is an excert from a win32 php.in file
What you will need to check is the path to sendmail, make sure it is correct. Some Servers use other software besides sendmail to send mail, if so you need the correct path to the mail program. Usually a program will act as though it is sendmail and you need not worry with it.

Note that this file is from a win 32 machine and will not work on unix

StatiX
Reply With Quote Quick reply to this message  
Join Date: Aug 2006
Posts: 999
Reputation: EnderX is an unknown quantity at this point 
Solved Threads: 1
EnderX EnderX is offline Offline
Posting Shark

Re: Problems with PHP mail function.

 
0
  #5
Aug 30th, 2006
Running on Unix, so the windows-based code didn't help much. I tried to id the location of our sendmail program, since it's mentioned in the commented out stuff, but no such luck; still didn't want to work.

Any other suggestions for what might be going wrong?
Reply With Quote Quick reply to this message  
Join Date: Aug 2006
Posts: 999
Reputation: EnderX is an unknown quantity at this point 
Solved Threads: 1
EnderX EnderX is offline Offline
Posting Shark

Re: Problems with PHP mail function.

 
0
  #6
Aug 31st, 2006
Never mind, I found a workaround. I was able to modify an older perl script to send out the message for me, and I never had any problem writing the php-driven data to a file, simply to the mail server. Thanks for the assistance, though! I really appreciated it.

-EnderX
Reply With Quote Quick reply to this message  
Reply

This thread has been marked solved.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC