[MacOS, Apache 2.4, PHP 7.3.11, Wikindx (download a couple days ago), MariaDB 10.4.13]
I'm configuring the mail settings on my server and want to use /usr/bin/mail.
It works from the command line for both the Apache user (_www) and my own userID but I get an error "Could not execute: /user/bin/mail" when I run the mail test function in WikiNDX.
"/usr/bin/mail" has permissions that allow execution by others (as per my comments above), so I'm wondering if Apache's httpd.conf needs to be configured to allow access to that folder.
Thanks Stephane, but I'm able to send mail from the CLI using sudo -u _www /usr/bin/mail -s "Test" user@domain.tld < ~/index.php. The mail is delivered to my email.
This also works from within Bash scripts. Why won't it work from PHP?
I don't want to use a 3rd party server, and my server is already able to send mail using /usr/bin/mail. My mail server, where I'm receiving the email, has port 25 open, so there's no need to involve TSL or StartTSL.
Last edit: Nap 2020-07-15
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
You should never do sudo to send a mail. if you do, it's not well configured. All mail command are not the same on all Unices and mail is not a mail server but a mail client.
PHPMailer have been made to use a regular sendmail command which is a wrapper to talk to a mail server on Unices, or talk to a regular SMTP server (local or remote) .
Don't try to emulate the sendmail command with the mail command. It's doomed.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
it seems that to send the mail command on one line without following the /mail interactive prompts, you need to supply further parameters (which is what you do in your command line example). WIKINDX won't supply these extra parameters because it doesn't expect to use /mail. As Stéphane says, the PHPMailer interface WIKINDX uses is set up to use sendmail (as /mail itself does).
I think you need to enter the path in WIKINDX for sendmail.
Regards,
Mark
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Thanks Mark. I appreciate Stephane's and your responses.
The link you referred me to shows exactly how I'm using /usr/bin/mail.
I've tried setting the "SendMail Path" to usr/bin/mail but it's not working with SMTP Server set to either SMTP or SendMail.
From Stephane's comments, I gather that WIKINDX uses PHPMailer, which is of course intended for use in the wild. Our use case is a computer in our lab which is behind our university's VPN.
So, I gather, from the feedback that WIKINDX wasn't mean to be used like I'm wanting to.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
You must set the sendmail path to /usr/sbin/sendmail or wherever sendmail is located (NOT mail). And, of course, SMTP server should be set to 'Sendmail'. If I remember correctly, the path can even be left blank and PHPMailer will try to find sendmail. Best to explicitly set it.
sendmail is the actual program that does the work regardless of whether it is accessed through WIKINDX/PHPMailer or usr/bin/mail both of which are just frontends to sendmail.
From the link I posted earlier:
mail command -> /usr/sbin/sendmail -> local MTA (smtp server) -> recipient MTA (and Inbox)
Regards,
Mark
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
[MacOS, Apache 2.4, PHP 7.3.11, Wikindx (download a couple days ago), MariaDB 10.4.13]
I'm configuring the mail settings on my server and want to use /usr/bin/mail.
It works from the command line for both the Apache user (
_www
) and my own userID but I get an error "Could not execute: /user/bin/mail" when I run the mail test function in WikiNDX."/usr/bin/mail" has permissions that allow execution by others (as per my comments above), so I'm wondering if Apache's httpd.conf needs to be configured to allow access to that folder.
Any suggestions?
Hello,
You can't do that.
/usr/bin/mail
is a client, not a server relaying messages. You have to setup a mail server on your machine.Like that or that.
If you already did it, the right sendmail command is explained here:
https://stackoverflow.com/questions/8162529/how-to-configure-php-ini-file-for-mail-in-mac-os
Regards,
Thanks Stephane, but I'm able to send mail from the CLI using
sudo -u _www /usr/bin/mail -s "Test" user@domain.tld < ~/index.php
. The mail is delivered to my email.This also works from within Bash scripts. Why won't it work from PHP?
I don't want to use a 3rd party server, and my server is already able to send mail using
/usr/bin/mail
. My mail server, where I'm receiving the email, has port 25 open, so there's no need to involve TSL or StartTSL.Last edit: Nap 2020-07-15
You should never do
sudo
to send a mail. if you do, it's not well configured. Allmail
command are not the same on all Unices andmail
is not a mail server but a mail client.PHPMailer have been made to use a regular
sendmail
command which is a wrapper to talk to a mail server on Unices, or talk to a regular SMTP server (local or remote) .Don't try to emulate the
sendmail
command with themail
command. It's doomed.I'm using
sudo
there to switch to the Apache user. It's not needed to send mail from my own account.This does not change the rest of my explanation.
Hi Nap,
It's a long time since I've played around with Linux and command line . . .
However, looking at this:
https://www.binarytides.com/linux-mail-command-examples/
it seems that to send the mail command on one line without following the /mail interactive prompts, you need to supply further parameters (which is what you do in your command line example). WIKINDX won't supply these extra parameters because it doesn't expect to use /mail. As Stéphane says, the PHPMailer interface WIKINDX uses is set up to use sendmail (as /mail itself does).
I think you need to enter the path in WIKINDX for sendmail.
Regards,
Mark
Thanks Mark. I appreciate Stephane's and your responses.
The link you referred me to shows exactly how I'm using
/usr/bin/mail
.I've tried setting the "SendMail Path" to
usr/bin/mail
but it's not working with SMTP Server set to either SMTP or SendMail.From Stephane's comments, I gather that WIKINDX uses PHPMailer, which is of course intended for use in the wild. Our use case is a computer in our lab which is behind our university's VPN.
So, I gather, from the feedback that WIKINDX wasn't mean to be used like I'm wanting to.
Hi Nap,
You must set the sendmail path to /usr/sbin/sendmail or wherever sendmail is located (NOT mail). And, of course, SMTP server should be set to 'Sendmail'. If I remember correctly, the path can even be left blank and PHPMailer will try to find sendmail. Best to explicitly set it.
sendmail is the actual program that does the work regardless of whether it is accessed through WIKINDX/PHPMailer or usr/bin/mail both of which are just frontends to sendmail.
From the link I posted earlier:
mail command -> /usr/sbin/sendmail -> local MTA (smtp server) -> recipient MTA (and Inbox)
Regards,
Mark
Cheers Mark. Though it didn't work before,
/usr/sbin/sendmail
in the path field works now. Maybe I hadn't press "Proceed" before I attempted the test.Glad it's working now Nap. The other common error is to do /usr/bin/sendmail instead of /usr/sbin/sendmail.
Is your wikindx publicly available for read only? I like seeing where our work is used . . .
Regards,
Mark
I'm afraid it is not since it's behind the Uni's VPN. But if you want to see it, I can host a Jitsi video conference and screen share with you.
Send me an email to Napoleon_BlownApart using the ABMS.net.au domain.
Mark, I replied from a different email account to the one mentioned above. Did you get my mail?