Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8969005
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T17:32:00+00:00 2026-06-15T17:32:00+00:00

PHP mail() works fine when I use this command php -r mail(‘pzuraq@gmail.com’, ‘Test Email’,

  • 0

PHP mail() works fine when I use this command

php -r "mail('pzuraq@gmail.com', 'Test Email', 'Test email body');" 

However, when I try to run it via a webpage it doesn’t work. I’m using a global config file in /etc/msmtprc, though I’m thinking about trying to duplicate it and give ownership to apache because apparently msmtp is weird about config files and permissions (the current user has to own the file and the permissions have to be 600) but this shouldn’t apply with the global config.

When I run the mail() function on the webpage, it returns false and doesn’t print any error to the log.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T17:32:01+00:00Added an answer on June 15, 2026 at 5:32 pm

    The point is that you have different php.ini files for cli & apache php executable.
    So your cli php.ini version is configured as it’s supposed to, but your apache php.ini (or, rather, your web server’s php.ini is probably not configured properly.

    In other words, command-line php and web php use different configuration.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

We currently have a working php mail script, this works fine and as we
I configured an SMTP server accessible via localhost. PHP mail() command works fine, I
I have a php mail script that works just fine as long as I
I'm using PHP's mail() function to send SMS messages. It works fine, except that
OK, so I have a PHP mail function. It works fine when I put
I'm using the php mail function, it works kinda fine, i really don't like
I have a small script which im using to test PHP mail(), as below:
As the title said: Is it possible to send an email (using php mail())
I host my site with GoDaddy , and I use the PHP mail() function
i am using php and mail function , but i face this error: Warning:

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.