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!
  • 1 Users Found This Useful
Was this answer helpful?

Related Articles

How to reset SSH port back to default port 22?

In some situations most of us may come across a problem that we are able to log into the WHM but...

How to setup the root login alert notification email?

Its very important to keep a check on your servers and who logs into the server, From security...

How to enable Open SSL on WHM?

Before enabling open SSL, you can check whether it is already enabled on your server. Please fire...

How to install mod_pagespeed on WHM?

'mod_pagespeed' is module of Apache which is nothing but plugin which is used for compressing the...

How to enable Hot Link Protection in cPanel?

To avoid other sites to use your website's bandwidth, you can enable the hot link protection....

Powered by WHMCompleteSolution