sendmail cannot be called directly from a shell with the current user id

While sending email using sendmail scirpt, I was getting the error message as -
sendmail: sendmail cannot be called directly from a shell with the current user id

Solution -

1. Login to WHM using root access.
2. Follow - Home >> Server Configuration >> Tweak Settings
3. Disable below two options -

i.  Track email origin via X-Source email headers
ii. Prevent “nobody” from sending email

It resolved my issue. Email sent successfully.

Logs of email has been sent successfully are as follow -

2017-07-14 01:44:01 cwd=/home/cpanel_username/public_html/cgi-bin 2 args: /usr/sbin/sendmail -t
2017-07-14 01:44:01 message_id <= from_email_address U=nobody P=local S=1468 T="Application Name"
for to_email_address
2017-07-14 01:44:01 cwd=/var/spool/exim 3 args: /usr/sbin/exim -Mc 1dVvGb-00056K-D3
2017-07-14 01:44:02 message_id3 => to_email_address <to_email_address> R=lookuphost T=remote_smtp
H=email_service_name [mail_server_ip_address] X=TLSv1.2:DHE-RSA-AES256-GCM-SHA384:256 CV=yes C="250 2.0.0
Ok: queued as E8/6B-12306-E5778695"
2017-07-14 01:44:02 message_id Completed

Let me know your thoughts on it!
  • 2 Users Found This Useful
Was this answer helpful?

Related Articles

How to to know SSH port on the cPanel server?

Steps to know SSH port of cPanel server -1. Login to WHM with your login details. 2. Go to...

Failed: Account Restore Failed: “clean: Cannot cleanup top level directory:

While restoring the full cPanel backup file in 'tar.gz' format from WHM >> Backup >>...

How to exclude file/folder from backup (pkgacct) on cPanel server?

Is it possible to exlude file/folder from the full cPanel backup on cPanel server? Solution :-...

The following errors were found : Drupal not upgrading using Softaculous

While upgrading the Drupal from 8.19 to 8.21 from cPanel >> Softaculous Application...

Powered by WHMCompleteSolution