Solved

Using sendmail at the command line

Posted on 1998-12-11
5
395 Views
Last Modified: 2010-04-21
What is the commandline format to send a text file using sendmail? In linux, I want to send a file named test.txt to jcj@tiac.net. If I use "sendmail -v jcj@tiac.net", I can then enter the message and it reaches the end person. How can I send the premade file. I've done this in the past but have forgotten the command line syntax. Thank you
jcj@tiac.net
0
Comment
Question by:jay8142
5 Comments
 
LVL 84

Expert Comment

by:ozo
ID: 2008393
sendmail -v jcj@tiac.net < test.txt
0
 

Accepted Solution

by:
rkuethe earned 50 total points
ID: 2008394
Try this, this will put the text of "mail.txt" into the message body, still looking into how to send it as an "attachment"

sendmail -v jcj@tiac.net </export/home/jcj/mail.txt        
0
 

Expert Comment

by:rkuethe
ID: 2008395
How about:

mail -f myfile.txt

then follow prompts:
Subject, recipient, etc.
"Ctrl-D" to end message.

0
 
LVL 1

Expert Comment

by:toTo
ID: 2008396
rkuethe, i'm afraid      mail -f myfile.txt
is to extract mail from an alternate mailbox called myfile.txt
0
 

Expert Comment

by:rballen
ID: 2008397
Try this from the UNIX command line:

( cat /tmp/a ; uuencode /tmp/a file.txt ) | sendmail rallen@devifx1
0

Featured Post

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

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

Let's say you need to move the data of a file system from one partition to another. This generally involves dismounting the file system, backing it up to tapes, and restoring it to a new partition. You may also copy the file system from one place to…
My previous tech tip, Installing the Solaris OS From the Flash Archive On a Tape (http://www.experts-exchange.com/articles/OS/Unix/Solaris/Installing-the-Solaris-OS-From-the-Flash-Archive-on-a-Tape.html), discussed installing the Solaris Operating S…
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…
This video shows how to set up a shell script to accept a positional parameter when called, pass that to a SQL script, accept the output from the statement back and then manipulate it in the Shell.

756 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