Solved

How to send email in Unix command line

Posted on 2011-03-15
2
594 Views
Last Modified: 2012-05-11
Can someone tell me the command I can use to send myself a test email from the Unix command line?  I also need the ability to attach a small text file that is in the same directory from which I will be running the command.  

I will be using localhost as the SMTP server and no authentication is needed.
0
Comment
Question by:jbaird123
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 3

Accepted Solution

by:
Alberto Cortes earned 500 total points
ID: 35141847
Solution:

to send email in Unix prompt using mail:
cat $FILE | mail -s "This is the subject" somebody@email.address

to send email in Unix prompt using mailx:
cat $FILE | mailx -s "This is the subject" somebody@email.address

remember that you need to configure sendmail (/etc/mail/sendmail.mc) and define your SMTP provider, before this can be successful.
0
 

Author Comment

by:jbaird123
ID: 35142002
Thanks!
0

Featured Post

Back Up Your Microsoft Windows Server®

Back up all your Microsoft Windows Server – on-premises, in remote locations, in private and hybrid clouds. Your entire Windows Server will be backed up in one easy step with patented, block-level disk imaging. We achieve RTOs (recovery time objectives) as low as 15 seconds.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Introduction We as admins face situation where we need to redirect websites to another. This may be required as a part of an upgrade keeping the old URL but website should be served from new URL. This document would brief you on different ways ca…
Google Drive is extremely cheap offsite storage, and it's even possible to get extra storage for free for two years.  You can use the free account 15GB, and if you have an Android device..when you install Google Drive for the first time it will give…
Learn several ways to interact with files and get file information from the bash shell. ls lists the contents of a directory: Using the -a flag displays hidden files: Using the -l flag formats the output in a long list: The file command gives us mor…
Connecting to an Amazon Linux EC2 Instance from Windows Using PuTTY.

733 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question