User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the PHP section within the Web Development category of DaniWeb, a massive community of 391,612 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 2,604 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our PHP advertiser: Lunarpages PHP Web Hosting
Views: 3292 | Replies: 5 | Solved
Reply
Join Date: Aug 2006
Posts: 999
Reputation: EnderX is an unknown quantity at this point 
Rep Power: 3
Solved Threads: 1
EnderX EnderX is offline Offline
Posting Shark

Problems with PHP mail function.

  #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
AddThis Social Bookmark Button
Reply With Quote  
Join Date: Aug 2006
Posts: 32
Reputation: StatiX is an unknown quantity at this point 
Rep Power: 2
Solved Threads: 2
StatiX's Avatar
StatiX StatiX is offline Offline
Light Poster

Re: Problems with PHP mail function.

  #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  
Join Date: Aug 2006
Posts: 999
Reputation: EnderX is an unknown quantity at this point 
Rep Power: 3
Solved Threads: 1
EnderX EnderX is offline Offline
Posting Shark

Re: Problems with PHP mail function.

  #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  
Join Date: Aug 2006
Posts: 32
Reputation: StatiX is an unknown quantity at this point 
Rep Power: 2
Solved Threads: 2
StatiX's Avatar
StatiX StatiX is offline Offline
Light Poster

Re: Problems with PHP mail function.

  #4  
Aug 28th, 2006
I don't have a unix box handy, just windows but this is what you would need to look at:
*****************************************
[mail function]
; For Win32 only.
SMTP = localhost
smtp_port = 25

; For Win32 only.
;sendmail_from = me@example.com

; For Unix only.  You may supply arguments as well (default: "sendmail -t -i").
;sendmail_path = "C:\Program Files\xampp\sendmail\sendmail.exe -t"

; Force the addition of the specified parameters to be passed as extra parameters
; to the sendmail binary. These parameters will always replace the value of
; the 5th parameter to mail(), even in safe mode.
;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  
Join Date: Aug 2006
Posts: 999
Reputation: EnderX is an unknown quantity at this point 
Rep Power: 3
Solved Threads: 1
EnderX EnderX is offline Offline
Posting Shark

Re: Problems with PHP mail function.

  #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  
Join Date: Aug 2006
Posts: 999
Reputation: EnderX is an unknown quantity at this point 
Rep Power: 3
Solved Threads: 1
EnderX EnderX is offline Offline
Posting Shark

Re: Problems with PHP mail function.

  #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  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

DaniWeb PHP Marketplace
Thread Tools Display Modes

Similar Threads
Other Threads in the PHP Forum

All times are GMT -4. The time now is 12:19 am.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC