Era Host hosting
EraHost – Free Domain, Cheap Hosting!
Client Area
Support 24/7
Menu

Understanding /usr/sbin/sendmail -fcrondaemon -i -odi -oem -oi -t -f root

4 min read
24.10.2025

This command uses the Sendmail binary (or a compatible mail transfer agent like Postfix or Exim) to send emails programmatically. It's a more complex usage, typically found in automated systems like cron jobs, where logs or notifications are emailed to administrators.

sendmail -fcrondaemon Complex Command
Long sendmail invocation — cron's way of mailing job output.

For closely related sendmail / script-mail topics, see Using /usr/sbin/sendmail -bs, /usr/sbin/sendmail -t -i, What is /usr/sbin/sendmail -t -i?, and Sendmail with File Attachment.

Breaking Down the Command

Full Command: /usr/sbin/sendmail -fcrondaemon -i -odi -oem -oi -t -f root

/usr/sbin/sendmail

The path to the Sendmail binary used to process and deliver email.

-fcrondaemon

Specifies the "envelope sender" address (Return-Path). This address is used for bounce messages if the email cannot be delivered.

Example: -fcrondaemon sets the sender as crondaemon@yourserver.com.

-i

Ignores a single period (.) on a line as a message-ending indicator. This ensures that email bodies containing isolated dots are not prematurely truncated.

-odi

Sets delivery mode to interactive, meaning Sendmail processes the email immediately and doesn?t queue it for later delivery.

-oem

Ensures that if the email cannot be delivered, an error message is returned to the sender (envelope sender).

-oi

Prevents premature termination of the email when encountering lines containing only a dot (.).

-t

Instructs Sendmail to read recipient addresses (To, Cc, Bcc) from the message headers instead of specifying them as command-line arguments.

-f root

An additional -f flag to set root as the sender address. It?s a duplicate in this command, but typically only one -f is necessary.

Linux VDS
High performance for your projects
  • Root access and flexible setup
  • Control panel
  • NVMe disks
  • DDR5
Linux VDS

Purpose of This Command

This command is often used in:

  1. Cron Jobs: Sends output or error messages from scheduled tasks to the specified email address.
    • Example: If a cron job fails or produces output, the crondaemon sender is used to notify the administrator.
  2. System Notifications: Sends automated system alerts or logs (e.g., failed backups, system errors) to administrators.

How It Works

When this command is executed:

  1. The message body and headers (including To, Cc, Bcc) are read from the standard input (stdin) or a specified file.
  2. Sendmail processes the message using the specified options.
  3. The email is sent to the recipient(s), with the sender set as crondaemon@yourdomain.com or root@yourdomain.com.

Example Usage

Email Content

Save the email headers and body in a file called email.txt:

To: admin@example.com

        Subject: Cron Job Alert

        

        The cron job failed. Please check the logs for details.

Send Command

/usr/sbin/sendmail -fcrondaemon -i -odi -oem -oi -t < email.txt

Common Issues and Solutions

Issue Solution
Emails Not Being Sent
  • Check the mail queue: mailq
  • Clear stuck messages: sudo postsuper -r ALL
Bounce Emails Due to Incorrect -f Sender
  • Ensure that the sender domain (crondaemon@yourdomain.com) has proper DNS records (SPF, DKIM, DMARC).
  • Verify that the sender address is valid and accepted by the receiving server.
Debugging Issues Enable verbose mode for more details:
/usr/sbin/sendmail -v -fcrondaemon -i -odi -oem -oi -t < email.txt
Prevent Abuse
  • Limit who can execute Sendmail.
  • Use authenticated SMTP for outgoing emails if possible.

Alternative: Use Postfix or a Script

For simpler and more modern setups, you can use:

  • mail utility: mailx for basic email sending.
  • Authenticated SMTP tools: msmtp or ssmtp for secure email delivery.
  • Programming libraries: Python?s smtplib for complex email workflows.
Frequently asked questions
Historical compatibility. Most flags are equivalent or duplicates (-i + -oi both mean ignore lone dot). The combo reliably works across sendmail variants from 30+ years of evolution. Replacing crond's internal call with a shorter equivalent would risk breaking obscure setups, so it stays.
Cron jobs run as a user, but mail output is sent as root by default. Envelope From = root means bounces and DSNs come back to root's mailbox. Override per-user by setting MAILTO in crontab. Without MAILTO, you get the default of mailing root@host.
Local mail not configured. Many minimal servers don't run a local MTA. `mail` command fails silently. Solutions: install Postfix/Exim, OR set MAILTO in crontab to '' (suppress mail) if you don't want output, OR redirect cron job output to log file (`2>&1 >> /var/log/myjob.log`) so you don't depend on mail.
Rarely. The structure makes sense for crond. Manual invocation: use simpler `sendmail -t < message.txt` or `mutt -s subj user@host < body`. The long-form is specifically the cron pattern; copying for manual use is overkill.
Related articles
What is /usr/sbin/sendmail -t -i?
Using /usr/sbin/sendmail -t to Send an Email from the Command Line
Understanding cm._domainkey: DKIM Selector Example