LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > SUSE / openSUSE
User Name
Password
SUSE / openSUSE This Forum is for the discussion of Suse Linux.

Notices


Reply
  Search this Thread
Old 07-24-2009, 10:57 AM   #16
s_linux
Member
 
Registered: Jul 2009
Posts: 83

Original Poster
Rep: Reputation: 15

I'm trying to attach file. But no luck...I tried your command...
uuencode /home/uname/Result Result.txt | mail -s "Health Check Status" uname@company.com

I got email with all junk like below..

begin 644 result.txt
M1$56(&5$:7)E8W1O<GD@5')E92!3=&%T=7,@:7,@3TL@;VX@>$1E=E1S=%5A
M=$EN=')A,@I-96UO<GD@4W1A='5S(&]N('A$9794<W15871);G1R83(Z($UE
M;3H@,S@V-S0T-&L@=&]T86PL(#$P,S`R,3)K('5S960L(#(X,S<R,S)K(&9R
M964L(#DP,C,V:R!B=69F97)S(2$*0U!5(%-T871U<R!O;B!X1&5V5'-T56%T

I also tried unix2dos, but it says command not found. just to let you know that Im using outlook 2007.

@s_linux
Can you send a copy to yourself on the Linux system and see what it looks like there? It would help to know when the mangling happens -- on the Linux system or later. The mail -c option followed by your username (without any @domain_name) should do it.
What are you using to send the mail from your Linux system to wherever? postfix, sendmail ... ?

-c option doent seems to be working. what you mean postfx, sendmail? Im just using mail command. Thanks
 
Old 07-24-2009, 11:48 AM   #17
catkin
LQ 5k Club
 
Registered: Dec 2008
Location: Tamil Nadu, India
Distribution: Debian
Posts: 8,578
Blog Entries: 31

Rep: Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208
Quote:
Originally Posted by s_linux View Post
-c option doent seems to be working. what you mean postfx, sendmail? Im just using mail command. Thanks
Works for me:
Code:
c@CW8:~$ echo 'jhfgjh 
fdsf
asdf' | mail -c c -s test root
That sent a copy to user c as well as to user root. I didn't get to see it on the local system because it's set up to forward all mail to my mail ISP and comes in to Outlook.

The mail command only generates local mail. How is it getting to your Outlook? I'm guessing that you have some ISP providing SMTP and POP3 mail servers. For the mail generated by the mail command to get to your ISP you need to transfer it, probably by SMTP, from your local system to your ISP (or Outlook could be collecting it directly from your local system). The commonest packages for doing SMTP are postfix and sendmail.

What does the output from
Code:
mail -wxyz
look like? Mine looks like
Code:
c@CW8:~$ mail -wxyz
mail: invalid option -- w
usage: mail [-eIinv] [-a header] [-b bcc-addr] [-c cc-addr] [-s subject] to-addr ...
            [-- sendmail-options ...]
       mail [-eIiNnv] -f [name]
       mail [-eIiNnv] [-u user]
This shows the -c option.

I'm beginning to wonder what your mail command is. What is the output from
Code:
type mail
/bin/ls -l /usr/bin/Mail /usr/bin/mail /usr/bin/mailx
Mine looks like
Code:
c@CW8:~$ type mail
mail is hashed (/usr/bin/mail)
c@CW8:~$ /bin/ls -l /usr/bin/Mail /usr/bin/mail /usr/bin/mailx
-rwxr-xr-x 1 root root 80316 2007-10-24 14:50 /usr/bin/mail
lrwxrwxrwx 1 root root     4 2009-06-24 23:07 /usr/bin/Mail -> mail
lrwxrwxrwx 1 root root     4 2009-06-24 23:07 /usr/bin/mailx -> mail
 
Old 07-24-2009, 12:25 PM   #18
s_linux
Member
 
Registered: Jul 2009
Posts: 83

Original Poster
Rep: Reputation: 15
This time i tried with c (I didn't read all your post by this time)option, i see some Undelivered Mail return to Sender. but message looks good. Then I tried following..
# echo 'testtesttest' | mail -c root
Send options without primary recipient specified.
Usage: mail [-BDFintv~] [-s subject] [-a attachment ] [-c cc-addr] [-b bcc-addr]
[-r from-addr] [-h hops] [-A account] [-R reply-addr] to-addr ...
mail [-BDeHiInNRv~] [-T name] [-A account] -f [name]
mail [-BDeinNRv~] [-A account] [-u user]

# echo 'testtesttest' | mail -c -s test root
hostname:/usr/local/bin # send-mail: invalid option -- s
send-mail: fatal: usage: send-mail [options]

Here is output of the commands which you gave me...
# mail -wxyz
mail: illegal option -- w
Usage: mail [-BDFintv~] [-s subject] [-a attachment ] [-c cc-addr] [-b bcc-addr]
[-r from-addr] [-h hops] [-A account] [-R reply-addr] to-addr ...
mail [-BDeHiInNRv~] [-T name] [-A account] -f [name]
mail [-BDeinNRv~] [-A account] [-u user]


# type mail
mail is hashed (/usr/bin/mail)


/bin/ls -l /usr/bin/Mail /usr/bin/mail /usr/bin/mailx
lrwxrwxrwx 1 root root 4 Nov 13 2008 /usr/bin/Mail -> nail
lrwxrwxrwx 1 root root 4 Nov 13 2008 /usr/bin/mail -> nail
lrwxrwxrwx 1 root root 4 Nov 13 2008 /usr/bin/mailx -> nail

Thanks.

Last edited by s_linux; 07-24-2009 at 12:42 PM.
 
Old 07-24-2009, 02:23 PM   #19
rn_
Member
 
Registered: Jun 2009
Location: Orlando, FL, USA
Distribution: Suse, Redhat
Posts: 127
Blog Entries: 1

Rep: Reputation: 25
Quote:
Originally Posted by s_linux View Post
I also tried unix2dos, but it says command not found.
you will need the unix2dos package installed for this.


Quote:
Originally Posted by s_linux View Post
just to let you know that Im using outlook 2007.
I am using outlook 2007 as well, and uuencode works for me! hmmm.. it appears as if something "ate" off the 'end'. There's supposed to be an 'end' keyword at the end of the uuencoded block. If I manually remove the 'end' and mail the file i get the same result as you. I'm not sure what could be doing that.

just in case something is chomping of the last line, try this:

Code:
{ uuencode /home/uname/Result Result.txt ; echo ; echo ; } | mail -s "Health Check Status" uname@company.com
!! KEEP THE SPACES before and after the { } !!
 
Old 07-25-2009, 03:47 AM   #20
catkin
LQ 5k Club
 
Registered: Dec 2008
Location: Tamil Nadu, India
Distribution: Debian
Posts: 8,578
Blog Entries: 31

Rep: Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208
Quote:
Originally Posted by s_linux View Post
This time i tried with c (I didn't read all your post by this time)option, i see some Undelivered Mail return to Sender. but message looks good. Then I tried following..
# echo 'testtesttest' | mail -c root
Send options without primary recipient specified.
You didn't specify the primary recipient, only the copy recipient. Let's keep close to the original problem (smart idea when doing tests) and add the copy recipient:
Code:
mail -c root -s "Health Check Status" uname@company.com < /home/uname/Result
Quote:
Originally Posted by s_linux View Post
Code:
# echo 'testtesttest' | mail -c -s test root
hostname:/usr/local/bin # send-mail: invalid option -- s
That's because you didn't put the name of the copy recipient after the -c option.

Quote:
Originally Posted by s_linux View Post
Here is output of the commands which you gave me...
Code:
# mail -wxyz
mail: illegal option -- w
Usage: mail [-BDFintv~] [-s subject] [-a attachment ] [-c cc-addr] [-b bcc-addr]
             [-r from-addr] [-h hops] [-A account] [-R reply-addr] to-addr ...
       mail [-BDeHiInNRv~] [-T name] [-A account] -f [name]
       mail [-BDeinNRv~] [-A account] [-u user]
That's very different to what I got suggesting your "mail" program is not the same as mine.

Quote:
Originally Posted by s_linux View Post
Code:
# type mail
mail is hashed (/usr/bin/mail)
/bin/ls -l /usr/bin/Mail /usr/bin/mail /usr/bin/mailx
lrwxrwxrwx 1 root root 4 Nov 13  2008 /usr/bin/Mail -> nail
lrwxrwxrwx 1 root root 4 Nov 13  2008 /usr/bin/mail -> nail
lrwxrwxrwx 1 root root 4 Nov 13  2008 /usr/bin/mailx -> nail
Ah ha! When you run the mail command it actually runs /usr/bin/nail which is an alternative package I have never used.

You could
  1. Read the nail documentation ...
  2. Check for any unusual configuration (what you are trying to do is straightforward and would probably work "out of the box")
  3. Do the test of sending a copy to a local user so you can see if the mangling happened when you composed the mail or when it was transmitted.
  4. Figure out how you mail is getting from the command line to Outlook, especially how it gets off your local system. The mangling could be happening there.
  5. Ask a new LQ question mentioning "nail (mailx alternative)" in the subject.
Best

Charles
 
  


Reply



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
Script to send email... bfloeagle Linux - General 5 10-13-2009 10:20 AM
send output of mysql query to email within same script hattori.hanzo Linux - Newbie 2 12-03-2008 03:14 AM
send email from a script r.stiltskin Ubuntu 7 07-26-2008 12:36 AM
how to send the output of cronjobs to another email address ? kirtikjr Linux - Software 1 07-12-2007 05:36 PM
How to send an email within a script??? johnsanty Programming 19 09-02-2006 12:43 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > SUSE / openSUSE

All times are GMT -5. The time now is 11:45 AM.

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
Open Source Consulting | Domain Registration