Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

PHP mail() function not working

Posted on 2003-02-28
6
Medium Priority
?
300 Views
Last Modified: 2007-12-19
I'm experiencing a strange situation on my FreeBSD web server. About two months ago when I first set it up, I tested PHP's mail() function, and it worked fine. Recently, when I tried to impliment a script that used it, it wouldn't work. No error message is given in reply, and I'm having a tough time figuring out where in the world to start. I'm far from a sendmail/unix expert. The sendmail daemon is running, and I've tried restarting it with no effect. The performance of the script doesn't change whether it's running or not (never gives an error message). Any ideas on what I could try to diagnose the problem?

-Jeff
0
Comment
Question by:jeffers
6 Comments
 
LVL 3

Accepted Solution

by:
NetWize earned 300 total points
ID: 8043566
Have you checked the sendmail-logs for errors? Maybe the local delivery works and it's a general SMTP-Problem?

Have you tried sending mail from shell (with "mail user@host.com") command?
0
 
LVL 2

Expert Comment

by:tconnolly
ID: 8043568
I had a similar problem where I was hosting several sites with a host, and on one site, the php mail() function worked and on another, it didn't. The only discrepancy I could find between the different servers was the version of PHP. The server with 4.2.2 worked but the ones (i tried more than one) with 4.2.3 did not. I can only imagine it had something to do with configuration or the upgrade when installed, but just a couple of pennies for ya.

Hope this helps :)
Tom Connolly
0
 

Expert Comment

by:spanky302
ID: 8044312
Hey jeffers,

Also check your php.ini file for your sendmail path.
You can also find this via the phpinfo() function.

E
0
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 

Author Comment

by:jeffers
ID: 8044855
I tried to use "mail user@host.com", and at the end I get the following error, which I also get using the sendmail command directly:

can not chdir(/var/spool/clientmqueue/): Permission denied
Program mode requires special privileges, e.g., root or TrustedUser.

lrwxrwxrwx  1 root   wheel .. /usr/sbin/sendmail -> /usr/sbin/mailwrapper
-r-xr-xr-x  1 root   smmsp .. /usr/sbin/mailwrapper
drwxrwxrwx  2 smmsp  smmsp .. /var/spool/clientmqueue

I found some about this on google, and it said to set sendmail's GID to smmsp, but didn't mention that sendmail was a link. I tried setting the link's GID, but it just stays "wheel". I did change mailwrapper's GID to smmsp, but that had no effect on the error message.
0
 
LVL 1

Expert Comment

by:tenacious
ID: 8045216
One of the criticisms I voice over and over again is that minor releases of PHP result in seemingly needless changes to APIs and functionality.  Often these changes are undocumented and developers don't see problems until they take a working code set to a different version of PHP.  I've experienced major headaches when I upgraded PHP from 4.0.2 to 4.1.1 on a server with running applications.  Or even worse going from 4.1.3 to 4.2.1.  In some cases parameter lists of established functions actually change.

I experienced problems with sendmail() on a windows environment.  If attachments were >3889 bytes the sendmail() function would just crash the process, not producing any error.  I would see no error log messages, nothing in the SMTP server, and nothing on the browser (nor an e-mail).  After taking apart the _source code_ for PHP i noticed the sendmail() function had some code written just for windows that limited the size of the header parameter to 4K bytes.  That seemed to be the culprit, it was reproduced, and hopefully it's been fixed (but I don't know).  After many tries at different workarounds I ended up just writing the RSC-compliant text to a file and then called a DOS program to send that file as e-mail.  There are third-party products that I could've bought as an alternative and used within PHP much like sendmail() - but I didn't have the money...
0
 

Author Comment

by:jeffers
ID: 8046907
I finally resolved the problem with the following:

cd /usr/src/etc && make DESTDIR=/ distrib-dirs

Thanks everybody for the tips that helped me find the solution.
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Strategic internal linking is often considered an SEO power technique, especially for content marketing. Do you need to hire an SEO agency to optimize you internal linking? No, this article will help you understand the basics of internal linking and…
How do you create a user-centered user experience on your website? And what are some things you should consider in the process?
Viewers will get an overview of the benefits and risks of using Bitcoin to accept payments. What Bitcoin is: Legality: Risks: Benefits: Which businesses are best suited?: Other things you should know: How to get started:
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
Suggested Courses
Course of the Month11 days, 2 hours left to enroll

571 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question