Easy question

Posted on 2002-06-04
Last Modified: 2010-04-21
How do I email myself a simple text file in UNIX.  For example I have a file called support.txt in a unix dir.  and I need it mailed to a address  Please include the syntax and a good example.  I need send as a attachment  That would be nice.
Question by:UnixKid
  • 3
  • 3
  • 2
LVL 51

Expert Comment

ID: 7054119
LVL 38

Expert Comment

ID: 7055173
You can use:

 mailx -s"Subject" your-email-add < inputfile

 where: your-email-add could be a list of email address seperate by ","

  mailx -s"This is support.txt" < ${INFILE}


 you cab simple use mail:

 mail email-list < inputfile


Author Comment

ID: 7055416
Should the script look like the following message:

mailx -s"This is support.txt" < $/export/home/vega/test.txt

I try the following and it did not work, what I am I doing wrong
LVL 38

Accepted Solution

yuzh earned 50 total points
ID: 7055479
if you are not using var for your file you should use put the following in your script:

/usr/bin/mailx -s"This is support.txt" < /export/home/vega/test.txt

  Note: there is no "$" in front of a real file name.
        use "$" when you are referening to the value of a

Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

LVL 51

Expert Comment

ID: 7055904
did you ask for ATTACHMENT (as decribed in the RFCs) ?
then it does not work as described. Dot.

Read my other comments, then try it.

Author Comment

ID: 7055955
Thank, it works great.
LVL 51

Expert Comment

ID: 7056545
would you please tell me the UNIX flaviour and version, as well as the mailx version, where this command produces a mail with an attachment and not just a plain text mail.

Author Comment

ID: 7057776
Sun 8, I don't now the mail version.

Featured Post

Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
sort command HPUX 11 53
Best software for Unix commands in Windows cmd.exe? 18 95
nodeip 9 68
Host issue and need to move VM's 2 220
Attention: This article will no longer be maintained. If you have any questions, please feel free to mail me. Please see for the updated article. It is avail…
This tech tip describes how to install the Solaris Operating System from a tape backup that was created using the Solaris flash archive utility. I have used this procedure on the Solaris 8 and 9 OS, and it shoudl also work well on the Solaris 10 rel…
Learn how to find files with the shell using the find and locate commands. Use locate to find a needle in a haystack.: With locate, check if the file still exists.: Use find to get the actual location of the file.:
Learn how to navigate the file tree with the shell. Use pwd to print the current working directory: Use ls to list a directory's contents: Use cd to change to a new directory: Use wildcards instead of typing out long directory names: Use ../ to move…

708 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now