Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

PHP mail from prompt

Posted on 2014-04-15
5
Medium Priority
?
279 Views
Last Modified: 2014-07-08
mail command works from PHP web script but not when I run it from prompt.

I run it by root and everything else in the script is working well, including updating database, etc.

Running CentOS with PHP 5.2.7

Here is php.ini mail dump:
# /usr/bin/php -i | grep -i mail | more
mail.force_extra_parameters => no value => no value
sendmail_from => no value => no value
sendmail_path => /usr/sbin/sendmail -t -i => /usr/sbin/sendmail -t -i
Path to sendmail => /usr/sbin/sendmail -t -i
MAIL => /var/spool/mail/root
_SERVER["MAIL"] => /var/spool/mail/root
_ENV["MAIL"] => /var/spool/mail/root
0
Comment
Question by:flowerbloom
  • 3
5 Comments
 
LVL 111

Expert Comment

by:Ray Paseur
ID: 40002881
No points for this please...

... with PHP 5.2.7
PHP 5.2 is not supported any more (not for several years) and is not supported even for security fixes.  My recommendation is to drop what you're doing and upgrade PHP now to PHP 5.4+ or PHP 5.5+ so you do not become the victim of an attack.  Then try this application again and come back to EE if you still are experiencing troubles.
0
 
LVL 19

Expert Comment

by:xterm
ID: 40004155
Please post your mail() command, and then tell us any output from it when you run it from the command line.  Also, look at the last few lines of the mail log at the time you send (tail -10 /var/log/maillog) and then afterwards, look in /var/spool/mqueue and /var/spool/clientmqueue to see if your mails are sitting there waiting to go out.

You might also turn up the debug level in your PHP script temporarily to get more output on what is or what is not working.

Your situation is unusual in that usually things will work fine when run as root from the CLI, but not so much when run via Apache's restricted environment.
0
 
LVL 1

Author Comment

by:flowerbloom
ID: 40041654
# mail -s subject person@domain.com
text
CTRL-D
cc: CTRL-D
#
0
 
LVL 1

Accepted Solution

by:
flowerbloom earned 0 total points
ID: 40174810
Emails were blocked by the firewall.  Firewall configuration has been modified, everything is well.
0
 
LVL 1

Author Closing Comment

by:flowerbloom
ID: 40182250
I research the issue and found a solution.
0

Featured Post

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.

Question has a verified solution.

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

There are times when I have encountered the need to decompress a response from a PHP request. This is how it's done, but you must have control of the request and you can set the Accept-Encoding header.
I have written articles previously comparing SARDU and YUMI.  I also included a couple of lines about Easy2boot (easy2boot.com).  I have now been using, and enjoying easy2boot as my sole multiboot utility for some years and realize that it deserves …
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …
Suggested Courses
Course of the Month10 days, 12 hours left to enroll

885 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