{"id":8718,"date":"2020-06-27T09:11:51","date_gmt":"2020-06-27T13:11:51","guid":{"rendered":"http:\/\/local.brightwhiz\/?p=8718"},"modified":"2021-12-04T08:35:40","modified_gmt":"2021-12-04T08:35:40","slug":"bash-mail-command-not-found","status":"publish","type":"post","link":"http:\/\/local.brightwhiz\/bash-mail-command-not-found\/","title":{"rendered":"Bash mail: command not found: CentOS, Redhat, Ubuntu, and Debian"},"content":{"rendered":"\n

The bash mail: command not found error can be triggered usually in fresh or minimal installations of any Linux<\/a> operating system. The reason for this is the operating system<\/a> vendors tend to include the bare minimum programs, tools, and utilities to make the system operational.<\/p>\n\n\n\n

The side-effect of this is that you are left without the option to send mail from the command line should you require to do it directly or through a bash script.<\/p>\n\n\n\n

There are other programs that can be used to send emails in Linux however today we are focusing on the mail command utility.<\/p>\n\n\n\n

Install Bash Mail Command<\/h2>\n\n\n\n

For those with Red hat (RHEL) based systems, this command is installed from mailx rpm packages while for those on Debian-based systems the command will be installed from the mailutils<\/em> package.<\/p>\n\n\n\n

Install mail command on CentOS\/Redhat:<\/p>\n\n\n\n

$ sudo yum install mailx<\/code><\/pre>\n\n\n\n

Install mail command on Ubuntu\/Debian<\/p>\n\n\n\n

$ sudo apt-get install mailutils<\/code><\/pre>\n\n\n\n

Send a Test Email to Confirm<\/h2>\n\n\n\n

After installing mail command packages on your system, you may want to send a test email using the below example.<\/p>\n\n\n\n

$ echo "Message Body" | mail -s "Message Subject" recipient@example.com<\/code><\/pre>\n\n\n\n

You can specify the sender using the command below:<\/p>\n\n\n\n

$ echo "Message Body" | mail -s "Message Subject" recipient@example.com -a From:sender@example.com<\/code><\/pre>\n\n\n\n

You can also load the message body from a file using the command below:<\/p>\n\n\n\n

$ mail -s "Message Subject" recipient@example.com -a From:sender@example.com < \/path\/to\/filename<\/code><\/pre>\n\n\n\n

Conclusion<\/h2>\n\n\n\n

In most cases, this is sufficient for simple diagnostics and alerts mailing you can use from your bash scripts. To handle more business kind use cases you may need other programs such as Postfix, Sendmail, Dovecot, fail2ban, and other systems to handle sending, receiving, and spam management.<\/p>\n\n\n\n

Anyway, that is how you install and use the bash mail command in Linux operating systems such as CentOS, Redhat, Ubuntu, and Debian among others.<\/p>\n","protected":false},"excerpt":{"rendered":"

The bash mail: command not found error can be triggered usually in fresh or minimal installations of any Linux operating system. The reason for this is the operating system vendors…<\/p>\n","protected":false},"author":1,"featured_media":8719,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[2,23,9,28,16,18],"tags":[121,184,193,219,354,363,431,433,573,591,598,604],"yoast_head":"\nBash mail: command not found: CentOS, Redhat, Ubuntu, and Debian<\/title>\n<meta name=\"description\" content=\"You can fix the bash mail: command not found you get from servers running CentOS, Redhat, Ubuntu, Debian, and other Linux distros with these simple steps\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"http:\/\/local.brightwhiz\/bash-mail-command-not-found\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Bash mail: command not found: CentOS, Redhat, Ubuntu, and Debian\" \/>\n<meta property=\"og:description\" content=\"You can fix the bash mail: command not found you get from servers running CentOS, Redhat, Ubuntu, Debian, and other Linux distros with these simple steps\" \/>\n<meta property=\"og:url\" content=\"http:\/\/local.brightwhiz\/bash-mail-command-not-found\/\" \/>\n<meta property=\"og:site_name\" content=\"Brightwhiz.com\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/brightwhiz\/\" \/>\n<meta property=\"article:published_time\" content=\"2020-06-27T13:11:51+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2021-12-04T08:35:40+00:00\" \/>\n<meta property=\"og:image\" content=\"http:\/\/local.brightwhiz\/wp-content\/uploads\/2020\/06\/bash-mail-command-not-found.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"1200\" \/>\n\t<meta property=\"og:image:height\" content=\"630\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"Michael Bright\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@brightwhizmag\" \/>\n<meta name=\"twitter:site\" content=\"@brightwhizmag\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Michael Bright\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"2 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"http:\/\/local.brightwhiz\/bash-mail-command-not-found\/#article\",\"isPartOf\":{\"@id\":\"http:\/\/local.brightwhiz\/bash-mail-command-not-found\/\"},\"author\":{\"name\":\"Michael Bright\",\"@id\":\"http:\/\/local.brightwhiz\/#\/schema\/person\/81f0f3126f13834ae2e7f381b3028e32\"},\"headline\":\"Bash mail: command not found: CentOS, Redhat, Ubuntu, and Debian\",\"datePublished\":\"2020-06-27T13:11:51+00:00\",\"dateModified\":\"2021-12-04T08:35:40+00:00\",\"mainEntityOfPage\":{\"@id\":\"http:\/\/local.brightwhiz\/bash-mail-command-not-found\/\"},\"wordCount\":279,\"publisher\":{\"@id\":\"http:\/\/local.brightwhiz\/#organization\"},\"image\":{\"@id\":\"http:\/\/local.brightwhiz\/bash-mail-command-not-found\/#primaryimage\"},\"thumbnailUrl\":\"http:\/\/local.brightwhiz\/wp-content\/uploads\/2020\/06\/bash-mail-command-not-found.jpg\",\"keywords\":[\"CentOS\",\"Debugging\",\"DevOps\",\"Email\",\"Linux\",\"Mail\",\"Operating Systems\",\"Optimization\",\"Systems Administration\",\"Tools\",\"Ubuntu\",\"Unix\"],\"articleSection\":[\"Articles\",\"Guides\",\"How To\",\"Software\",\"Technology\",\"Tools\"],\"inLanguage\":\"en-US\"},{\"@type\":\"WebPage\",\"@id\":\"http:\/\/local.brightwhiz\/bash-mail-command-not-found\/\",\"url\":\"http:\/\/local.brightwhiz\/bash-mail-command-not-found\/\",\"name\":\"Bash mail: command not found: CentOS, Redhat, Ubuntu, and Debian\",\"isPartOf\":{\"@id\":\"http:\/\/local.brightwhiz\/#website\"},\"primaryImageOfPage\":{\"@id\":\"http:\/\/local.brightwhiz\/bash-mail-command-not-found\/#primaryimage\"},\"image\":{\"@id\":\"http:\/\/local.brightwhiz\/bash-mail-command-not-found\/#primaryimage\"},\"thumbnailUrl\":\"http:\/\/local.brightwhiz\/wp-content\/uploads\/2020\/06\/bash-mail-command-not-found.jpg\",\"datePublished\":\"2020-06-27T13:11:51+00:00\",\"dateModified\":\"2021-12-04T08:35:40+00:00\",\"description\":\"You can fix the bash mail: command not found you get from servers running CentOS, Redhat, Ubuntu, Debian, and other Linux distros with these simple steps\",\"breadcrumb\":{\"@id\":\"http:\/\/local.brightwhiz\/bash-mail-command-not-found\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"http:\/\/local.brightwhiz\/bash-mail-command-not-found\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"http:\/\/local.brightwhiz\/bash-mail-command-not-found\/#primaryimage\",\"url\":\"http:\/\/local.brightwhiz\/wp-content\/uploads\/2020\/06\/bash-mail-command-not-found.jpg\",\"contentUrl\":\"http:\/\/local.brightwhiz\/wp-content\/uploads\/2020\/06\/bash-mail-command-not-found.jpg\",\"width\":1200,\"height\":630,\"caption\":\"Bash mail: command not found\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"http:\/\/local.brightwhiz\/bash-mail-command-not-found\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"http:\/\/local.brightwhiz\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Bash mail: command not found: CentOS, Redhat, Ubuntu, and Debian\"}]},{\"@type\":\"WebSite\",\"@id\":\"http:\/\/local.brightwhiz\/#website\",\"url\":\"http:\/\/local.brightwhiz\/\",\"name\":\"Brightwhiz.com\",\"description\":\"Best Tech guides, Tutorials, and News\",\"publisher\":{\"@id\":\"http:\/\/local.brightwhiz\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"http:\/\/local.brightwhiz\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"http:\/\/local.brightwhiz\/#organization\",\"name\":\"Brightwhiz\",\"url\":\"http:\/\/local.brightwhiz\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"http:\/\/local.brightwhiz\/#\/schema\/logo\/image\/\",\"url\":\"http:\/\/local.brightwhiz\/wp-content\/uploads\/2021\/11\/brightwhiz-com-logo-orange.png\",\"contentUrl\":\"http:\/\/local.brightwhiz\/wp-content\/uploads\/2021\/11\/brightwhiz-com-logo-orange.png\",\"width\":706,\"height\":135,\"caption\":\"Brightwhiz\"},\"image\":{\"@id\":\"http:\/\/local.brightwhiz\/#\/schema\/logo\/image\/\"},\"sameAs\":[\"https:\/\/www.facebook.com\/brightwhiz\/\",\"https:\/\/twitter.com\/brightwhizmag\",\"https:\/\/instagram.com\/bright_whiz\/\",\"https:\/\/www.pinterest.com\/sobbayi\/\",\"https:\/\/www.youtube.com\/channel\/UC6sCdP_d_RiTIM7ErFT-PSQ\"]},{\"@type\":\"Person\",\"@id\":\"http:\/\/local.brightwhiz\/#\/schema\/person\/81f0f3126f13834ae2e7f381b3028e32\",\"name\":\"Michael Bright\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"http:\/\/local.brightwhiz\/#\/schema\/person\/image\/\",\"url\":\"http:\/\/1.gravatar.com\/avatar\/da90485875ff0aafa38fdd494abe87d1?s=96&d=mm&r=g\",\"contentUrl\":\"http:\/\/1.gravatar.com\/avatar\/da90485875ff0aafa38fdd494abe87d1?s=96&d=mm&r=g\",\"caption\":\"Michael Bright\"},\"sameAs\":[\"https:\/\/sobbayi.com\"],\"url\":\"http:\/\/local.brightwhiz\/author\/sobbayiadmin\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Bash mail: command not found: CentOS, Redhat, Ubuntu, and Debian","description":"You can fix the bash mail: command not found you get from servers running CentOS, Redhat, Ubuntu, Debian, and other Linux distros with these simple steps","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"http:\/\/local.brightwhiz\/bash-mail-command-not-found\/","og_locale":"en_US","og_type":"article","og_title":"Bash mail: command not found: CentOS, Redhat, Ubuntu, and Debian","og_description":"You can fix the bash mail: command not found you get from servers running CentOS, Redhat, Ubuntu, Debian, and other Linux distros with these simple steps","og_url":"http:\/\/local.brightwhiz\/bash-mail-command-not-found\/","og_site_name":"Brightwhiz.com","article_publisher":"https:\/\/www.facebook.com\/brightwhiz\/","article_published_time":"2020-06-27T13:11:51+00:00","article_modified_time":"2021-12-04T08:35:40+00:00","og_image":[{"width":1200,"height":630,"url":"http:\/\/local.brightwhiz\/wp-content\/uploads\/2020\/06\/bash-mail-command-not-found.jpg","type":"image\/jpeg"}],"author":"Michael Bright","twitter_card":"summary_large_image","twitter_creator":"@brightwhizmag","twitter_site":"@brightwhizmag","twitter_misc":{"Written by":"Michael Bright","Est. reading time":"2 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"http:\/\/local.brightwhiz\/bash-mail-command-not-found\/#article","isPartOf":{"@id":"http:\/\/local.brightwhiz\/bash-mail-command-not-found\/"},"author":{"name":"Michael Bright","@id":"http:\/\/local.brightwhiz\/#\/schema\/person\/81f0f3126f13834ae2e7f381b3028e32"},"headline":"Bash mail: command not found: CentOS, Redhat, Ubuntu, and Debian","datePublished":"2020-06-27T13:11:51+00:00","dateModified":"2021-12-04T08:35:40+00:00","mainEntityOfPage":{"@id":"http:\/\/local.brightwhiz\/bash-mail-command-not-found\/"},"wordCount":279,"publisher":{"@id":"http:\/\/local.brightwhiz\/#organization"},"image":{"@id":"http:\/\/local.brightwhiz\/bash-mail-command-not-found\/#primaryimage"},"thumbnailUrl":"http:\/\/local.brightwhiz\/wp-content\/uploads\/2020\/06\/bash-mail-command-not-found.jpg","keywords":["CentOS","Debugging","DevOps","Email","Linux","Mail","Operating Systems","Optimization","Systems Administration","Tools","Ubuntu","Unix"],"articleSection":["Articles","Guides","How To","Software","Technology","Tools"],"inLanguage":"en-US"},{"@type":"WebPage","@id":"http:\/\/local.brightwhiz\/bash-mail-command-not-found\/","url":"http:\/\/local.brightwhiz\/bash-mail-command-not-found\/","name":"Bash mail: command not found: CentOS, Redhat, Ubuntu, and Debian","isPartOf":{"@id":"http:\/\/local.brightwhiz\/#website"},"primaryImageOfPage":{"@id":"http:\/\/local.brightwhiz\/bash-mail-command-not-found\/#primaryimage"},"image":{"@id":"http:\/\/local.brightwhiz\/bash-mail-command-not-found\/#primaryimage"},"thumbnailUrl":"http:\/\/local.brightwhiz\/wp-content\/uploads\/2020\/06\/bash-mail-command-not-found.jpg","datePublished":"2020-06-27T13:11:51+00:00","dateModified":"2021-12-04T08:35:40+00:00","description":"You can fix the bash mail: command not found you get from servers running CentOS, Redhat, Ubuntu, Debian, and other Linux distros with these simple steps","breadcrumb":{"@id":"http:\/\/local.brightwhiz\/bash-mail-command-not-found\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["http:\/\/local.brightwhiz\/bash-mail-command-not-found\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"http:\/\/local.brightwhiz\/bash-mail-command-not-found\/#primaryimage","url":"http:\/\/local.brightwhiz\/wp-content\/uploads\/2020\/06\/bash-mail-command-not-found.jpg","contentUrl":"http:\/\/local.brightwhiz\/wp-content\/uploads\/2020\/06\/bash-mail-command-not-found.jpg","width":1200,"height":630,"caption":"Bash mail: command not found"},{"@type":"BreadcrumbList","@id":"http:\/\/local.brightwhiz\/bash-mail-command-not-found\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"http:\/\/local.brightwhiz\/"},{"@type":"ListItem","position":2,"name":"Bash mail: command not found: CentOS, Redhat, Ubuntu, and Debian"}]},{"@type":"WebSite","@id":"http:\/\/local.brightwhiz\/#website","url":"http:\/\/local.brightwhiz\/","name":"Brightwhiz.com","description":"Best Tech guides, Tutorials, and News","publisher":{"@id":"http:\/\/local.brightwhiz\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"http:\/\/local.brightwhiz\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"en-US"},{"@type":"Organization","@id":"http:\/\/local.brightwhiz\/#organization","name":"Brightwhiz","url":"http:\/\/local.brightwhiz\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"http:\/\/local.brightwhiz\/#\/schema\/logo\/image\/","url":"http:\/\/local.brightwhiz\/wp-content\/uploads\/2021\/11\/brightwhiz-com-logo-orange.png","contentUrl":"http:\/\/local.brightwhiz\/wp-content\/uploads\/2021\/11\/brightwhiz-com-logo-orange.png","width":706,"height":135,"caption":"Brightwhiz"},"image":{"@id":"http:\/\/local.brightwhiz\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/brightwhiz\/","https:\/\/twitter.com\/brightwhizmag","https:\/\/instagram.com\/bright_whiz\/","https:\/\/www.pinterest.com\/sobbayi\/","https:\/\/www.youtube.com\/channel\/UC6sCdP_d_RiTIM7ErFT-PSQ"]},{"@type":"Person","@id":"http:\/\/local.brightwhiz\/#\/schema\/person\/81f0f3126f13834ae2e7f381b3028e32","name":"Michael Bright","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"http:\/\/local.brightwhiz\/#\/schema\/person\/image\/","url":"http:\/\/1.gravatar.com\/avatar\/da90485875ff0aafa38fdd494abe87d1?s=96&d=mm&r=g","contentUrl":"http:\/\/1.gravatar.com\/avatar\/da90485875ff0aafa38fdd494abe87d1?s=96&d=mm&r=g","caption":"Michael Bright"},"sameAs":["https:\/\/sobbayi.com"],"url":"http:\/\/local.brightwhiz\/author\/sobbayiadmin\/"}]}},"_links":{"self":[{"href":"http:\/\/local.brightwhiz\/wp-json\/wp\/v2\/posts\/8718"}],"collection":[{"href":"http:\/\/local.brightwhiz\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/local.brightwhiz\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/local.brightwhiz\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/local.brightwhiz\/wp-json\/wp\/v2\/comments?post=8718"}],"version-history":[{"count":0,"href":"http:\/\/local.brightwhiz\/wp-json\/wp\/v2\/posts\/8718\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"http:\/\/local.brightwhiz\/wp-json\/wp\/v2\/media\/8719"}],"wp:attachment":[{"href":"http:\/\/local.brightwhiz\/wp-json\/wp\/v2\/media?parent=8718"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/local.brightwhiz\/wp-json\/wp\/v2\/categories?post=8718"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/local.brightwhiz\/wp-json\/wp\/v2\/tags?post=8718"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}