![send mail command in linux send mail command in linux](https://cdn.linuxfordevices.com/wp-content/uploads/2020/06/mail_command_featured_image-1024x512.png)
- #Send mail command in linux how to#
- #Send mail command in linux install#
- #Send mail command in linux free#
Most of the newbie in Linux doesn't know that we can send email using telnet also, which is the better way to troubleshoot email sending problems.
#Send mail command in linux how to#
Read more: How to Setup SSMTP Server on LinuxĪs per my experience, all system administrators use telnet command to test remote port connectivity test or login to the server remotely.
![send mail command in linux send mail command in linux](https://www.tecmint.com/wp-content/uploads/2017/12/Send-Message-to-Linux-Users.png)
After that type your message to be sent to the user, After finishing your message press CTRL+d (^d) to send the email. Now type your subject of the email as below with keyword Subject.
![send mail command in linux send mail command in linux](https://blog.edmdesigner.com/content/images/2018/02/learn-email-sending-via-command-line-linux.png)
For example to send an email to user use following command. SSMTP allows users to send emails from SMTP server from Linux command line. Send an email including an attachment mutt -s "Test Email" -a /opt/backup.sql < /dev/null Use few of below examples to send an email. Mutt command is little similar to mail command. Mutt is basically used for reading emails from Linux terminal from local user mailboxes, also useful to read emails from POP/IMAP servers. You may face issue: Bash: mail: command not foundĪlso, we can add comma separated emails to send the email to multiple recipients together. Use -A for debian based systems, which uses mailutils package. mail -a /opt/backup.sql -s "Backup File" < /dev/null -s is used for defining subject for email.Īlso, you can send an attachment with this command.Mail command is most popular command to send emails from Linux terminal.
#Send mail command in linux install#
Read more: Install and Configure Sendmail on CentOS/RHEL Now send email using the following command. Subject: line will be used as subject for email. Use below instructions to send email using ‘ sendmail‘ command.Ĭreated a file with email content: cat /tmp/email.txt Sendmail allows sending email from command line. Sendmail is a most popular SMTP server used in most of Linux/Unix distribution. You can use anyone option given below to send email from Linux command line. There are various ways to send emails from the command line but here I am sharing few options used by most users. This is useful for sending email through our shell scripts, cronjobs etc. This tutorial will provide you multiple ways to send emails from the Linux command line. But this is not enough, sometimes we also required to send emails from system command line.
#Send mail command in linux free#
There are many free emails service providers which we used for use like Gmail, Yahoo, RediffMail etc, which provides a web interface for sending and receiving emails. Please let us know if you need something specific you want to achieve, you can send you queries using the comment box below.We all know the importance of emails these days for information transfer.
![send mail command in linux send mail command in linux](https://javapipe.com/images/sendmail-test.png)
These were some common examples only, there are plenty more applications for the mail command that you can achieve. $ mail -s “File output” it guys, we now end this tutorial on how to use Send mail from the terminal in Linux. To send the contents of the file using the mail command, we will use the following, $ mail -s “File Attached” -A test.txt 4- Sending a file content with mail For example, we need to send a file named ‘test.txt’, so we will use the following command, Now to send a mail with a file as an attachment, we will use option ‘A’ with the mail command. $ mail -s “test mail” 3- Sending a mail with an attachment $ mail -s “test mail” <<< “This is the body of the mail” 2- Send mail to multiple recipientsįor sending mail to more than one user, mention all email addresses followed by a comma. We can also use the following single line command to send mail, Now after you execute the above command, we need to enter the body content & once we are done, press CTRL + D to exit and send the mail. Here, -s option is used for mentioning the subject of mail followed by the email address on which we need to send the mail.