[Webinar] Streamline your web hosting managementRegister Today

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 312
  • Last Modified:

Easy question

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 myself@company.com.  Please include the syntax and a good example.  I need send as a attachment  That would be nice.
0
UnixKid
Asked:
UnixKid
  • 3
  • 3
  • 2
1 Solution
 
yuzhCommented:
You can use:

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

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

  eg:
  INFILE=/home/abc/support.txt
  mailx -s"This is support.txt" myself@company.com < ${INFILE}

  or

 you cab simple use mail:

 mail email-list < inputfile


 
0
 
UnixKidAuthor Commented:
Should the script look like the following message:

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

I try the following and it did not work, what I am I doing wrong
0
Learn to develop an Android App

Want to increase your earning potential in 2018? Pad your resume with app building experience. Learn how with this hands-on course.

 
yuzhCommented:
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" vega1@uakron.edu < /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
        var

0
 
ahoffmannCommented:
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.
0
 
UnixKidAuthor Commented:
Thank, it works great.
0
 
ahoffmannCommented:
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.
Thanks.
0
 
UnixKidAuthor Commented:
Sun 8, I don't now the mail version.
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

  • 3
  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now