LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 11-15-2011, 10:13 AM   #1
aggrishabh
Member
 
Registered: Nov 2010
Posts: 87

Rep: Reputation: 1
Mail format issue


Hi All,

i have one file which i want to send through mail from Linux machine.
i can use only mail command (restriction)

suppose file (abc.log) has be contents

abcdefgh
abcdefgh
abcdefgh

now few questions??

1) how i can send that file as a attachment (remember the constraint and no uuencode)

2) if i send this file via command
"mail -s "test log" rishabh.agarwal@abc.com < abc.log"
then it is showing test in continuous fashion (showing content in correct format on Linux machine).

abcdefghabcdefghabcdefgh

how can i overcome from this situation.

Regards
Rishabh Agarwal
 
Old 11-15-2011, 11:08 AM   #2
TB0ne
LQ Guru
 
Registered: Jul 2003
Location: Birmingham, Alabama
Distribution: SuSE, RedHat, Slack,CentOS
Posts: 17,919

Rep: Reputation: 3689Reputation: 3689Reputation: 3689Reputation: 3689Reputation: 3689Reputation: 3689Reputation: 3689Reputation: 3689Reputation: 3689Reputation: 3689Reputation: 3689
Quote:
Originally Posted by aggrishabh View Post
Hi All,
i have one file which i want to send through mail from Linux machine. i can use only mail command (restriction) suppose file (abc.log) has be contents

abcdefgh
abcdefgh
abcdefgh

now few questions??

1) how i can send that file as a attachment (remember the constraint and no uuencode)
Why is there a restriction/constraint on your own server??? Makes this sound like homework...is it?
Quote:
2) if i send this file via command
"mail -s "test log" rishabh.agarwal@abc.com < abc.log"
then it is showing test in continuous fashion (showing content in correct format on Linux machine).

abcdefghabcdefghabcdefgh

how can i overcome from this situation.
Assuming by this you are reading the message on a Windows system...Windows and *nix line feeds are different. You can probably change how the message is viewed on whatever mail client you're using and see if that helps. You can also just try:
Code:
mail -s "test log" -a <file name> <email address>
and see if that works, instead of using the "<" to do it. You could also write a script, use sed, or unix2dos commands to 'translate' the file into something Windows likes. But you provide no real details on what the remote system is running, and again, this sounds very much like homework.
 
Old 11-17-2011, 12:14 AM   #3
aggrishabh
Member
 
Registered: Nov 2010
Posts: 87

Original Poster
Rep: Reputation: 1
1) this is not a home work and i am a restricted user on that box.
2) -a is not a valid option in mail command.
3) yes, you are right i am using outlook as a mail client and script is running on RHEL 5.4
 
0 members found this post helpful.
Old 11-17-2011, 12:27 AM   #4
aggrishabh
Member
 
Registered: Nov 2010
Posts: 87

Original Poster
Rep: Reputation: 1
one more thing
i tried unix2dos command (unix2dos abc.log) and when i try to mail that converted file a dead letter in my home directory is created, and mail is reaching to me with old bad format.
 
0 members found this post helpful.
Old 11-17-2011, 01:20 AM   #5
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Centos 6.8, Centos 5.10
Posts: 17,240

Rep: Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324
You should find that the mailx cmd is available; try these
Code:
(cat file)|mailx -s "subject" emailaddr

mailx -a file -s "subject" emailaddr
in fact, the first will prob work with 'mail' as well.

http://linux.die.net/man/1/mail
 
1 members found this post helpful.
Old 11-17-2011, 09:39 AM   #6
TB0ne
LQ Guru
 
Registered: Jul 2003
Location: Birmingham, Alabama
Distribution: SuSE, RedHat, Slack,CentOS
Posts: 17,919

Rep: Reputation: 3689Reputation: 3689Reputation: 3689Reputation: 3689Reputation: 3689Reputation: 3689Reputation: 3689Reputation: 3689Reputation: 3689Reputation: 3689Reputation: 3689
Quote:
Originally Posted by aggrishabh View Post
1) this is not a home work and i am a restricted user on that box.
Even if you are a 'restricted' user, you'll have access to all the commands in /usr/bin and /bin, at a minimum.
Quote:
2) -a is not a valid option in mail command.
Yes, it is. Read the man page that chrism01 posted, or even type in "man mail" on your system. It's at the very top, thanks.
Quote:
3) yes, you are right i am using outlook as a mail client and script is running on RHEL 5.4
Ok..so did you look at the options in Outlook, and see if there was a way to change encoding/viewing?? And I had suggested previously that you write a script, and either use sed or unix2dos to make the file into something that Windows could handle natively. Have you?
 
Old 11-21-2011, 11:09 AM   #7
aggrishabh
Member
 
Registered: Nov 2010
Posts: 87

Original Poster
Rep: Reputation: 1
Thanks for all the inputs

http://unixhelp.ed.ac.uk/CGI/man-cgi?mail

Please refer to the above link of mail command what chrism01 is using is mailx command and -a is valid option for mailx but not for mail. i think mailx is not the default package in LINUX.

TB0ne please see my last post in this thread.
 
0 members found this post helpful.
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
can't relay mail: did not issue MAIL/EXPN/VRFY/ETRN JimmyTheSaint Linux - Server 20 12-18-2012 12:00 AM
mail loops back to me (MX problem?) OR did not issue MAIL/EXPN/VRFY/ETRN skc Linux - Server 6 07-09-2011 10:18 PM
Sendmail issue (did not issue MAIL/EXPNVRFY/ETRN ...) Blackout_08 Linux - Server 0 08-08-2007 02:10 PM
Import Mail from /var/spool/mail (sendmail) to a MailDir Format in Postfix shawnbishop Linux - Software 0 04-06-2006 11:44 AM


All times are GMT -5. The time now is 04:05 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration