How To Use Sendmail Command On Linux Tutorial with Examples? – POFTUT

How To Use Sendmail Command On Linux Tutorial with Examples?


sendmail is a mail transfer agent (MTA) used to send emails between computer systems by using simple mail transfer protocol (SMTP) . Sendmail project can be accessed from <a href="http://www.sendmail.org">www.sendmail.org</a>
<h1>Install On Ubuntu, Debian, Mint, Kali</h1>
sendmail  tool is provided by different packages on Ubuntu, Debian,Mint, Kali ordebbased distributions. In this case, we will install the package namedpostfix.
<pre class="">$ sudo apt install postfix</pre>

Install On Ubuntu, Debian, Mint, Kali
Install On Ubuntu, Debian, Mint, Kali

<h1>Install On Fedora, CentOS, RedHat</h1>
In
rpmbased distributions likeFedora, CentOS, RedHat we will usepostfixpackage to installsendmailtool.
<pre class="">$ sudo yum install postfix</pre>
<h1>sendmail.cf Configuration File</h1>
sendmailcommand has different configuration options. We can provide these options interactive command line duringsendmailcommand execution. But we can also set these options in configuration file/etc/sendmail.cfpermanently for all usages.
<h1>Sendmail Local Users</h1>
sendmailcommand can send mail to the local users. We just need to supply the user name of the local user to the sendmail utility. Then we will provide the mail content in a text or ASCII formation. For example we will set the subject with theSubject:` line like below.

$ sendmail ismail

List Mails or Inbox

Linux distributions provide the mail command which is used to list emails or inbox of the users. We can use mail command without providing an option to list currently logged user inbox or mails. We will see that previously sent mail will be listed and displayed in detail.

$ mail
List Mails or Inbox
List Mails or Inbox

We can see that detailed information about the email is listed.

  • Date
  • Return Path
  • Delivered To
  • Received
  • Subject
  • Message ID
LEARN MORE  Things To Do With Computer When Bored

Sendmail To The Internet

We can also send email to the internet user or popular email providers. We will just provide the email address of the user. Keep in mind that the smtp configuration should be done properly in order to send email to the internet. In this case we will send email to the poftut@gmail.com

$ sendmail poftut@gmail.com
Sendmail To The Internet
Sendmail To The Internet

Leave a Comment