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 01-06-2010, 03:27 PM   #1
dennismonsewicz
LQ Newbie
 
Registered: Apr 2009
Location: Tenessee
Distribution: ubuntu 8.x
Posts: 6

Rep: Reputation: 0
uuencode question


I am working on a shell script that will send mail with attachments, but I am running into a small problem

Code:
uuencode file.txt attachment_file_name.txt | mail -a 'FROM:test@test.com' -s 'Subject Here' first.last@gmail.com
The problem I am having is, that when you try to run this code the email does not get sent cause the code breaks at the . [dot] in my email address. But it does not care if there is a . [dot] in the emaill address in the FROM address.

Any suggestions?

Last edited by dennismonsewicz; 01-06-2010 at 05:27 PM.
 
Old 01-06-2010, 03:34 PM   #2
TB0ne
LQ Guru
 
Registered: Jul 2003
Location: Birmingham, Alabama
Distribution: SuSE, RedHat, Slack,CentOS
Posts: 18,316

Rep: Reputation: 3878Reputation: 3878Reputation: 3878Reputation: 3878Reputation: 3878Reputation: 3878Reputation: 3878Reputation: 3878Reputation: 3878Reputation: 3878Reputation: 3878
Quote:
Originally Posted by dennismonsewicz View Post
I am working on a shell script that will send mail with attachments, but I am running into a small problem

Code:
uuencode file.txt attachment_file_name.txt | mail -a 'FROM:test@test.com' -s 'Subject Here' dennis.monsewicz@gmail.com
The problem I am having is, that when you try to run this code the email does not get sent cause the code breaks at the . [dot] in my email address. But it does not care if there is a . [dot] in the emaill address in the FROM address.

Any suggestions?
Try to put a backslash \ in front of the period.
 
Old 01-06-2010, 03:54 PM   #3
dennismonsewicz
LQ Newbie
 
Registered: Apr 2009
Location: Tenessee
Distribution: ubuntu 8.x
Posts: 6

Original Poster
Rep: Reputation: 0
your suggestion worked thanks! The problem I am having now is that when I try to email my work address it doesn't work but if I email my personal email address it does...
 
Old 01-06-2010, 04:26 PM   #4
colucix
LQ Guru
 
Registered: Sep 2003
Location: Bologna
Distribution: CentOS 6.5 OpenSuSE 12.3
Posts: 10,509

Rep: Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976
Quote:
Originally Posted by dennismonsewicz View Post
your suggestion worked thanks! The problem I am having now is that when I try to email my work address it doesn't work but if I email my personal email address it does...
Different mail services, different rules. Did you get a returning mail with some useful error message?
 
Old 01-06-2010, 04:31 PM   #5
dennismonsewicz
LQ Newbie
 
Registered: Apr 2009
Location: Tenessee
Distribution: ubuntu 8.x
Posts: 6

Original Poster
Rep: Reputation: 0
Well I looked at the log files for mail and it is trying to send the mail to the username of the person logged into the shell who is running the uuencode script.

So if user is logged in and they run the script it tries to send the email to user@workaddy.com

I also modified some of the postfix settings to try to obey correctly
 
Old 01-06-2010, 05:16 PM   #6
dennismonsewicz
LQ Newbie
 
Registered: Apr 2009
Location: Tenessee
Distribution: ubuntu 8.x
Posts: 6

Original Poster
Rep: Reputation: 0
yeah every time I try to send an email and go check the error logs I am seeing the 'unknown user' error...

So if I run my script with the recipient being user@useremail.com

The error will return 'user is unknown user'
 
Old 01-06-2010, 05:22 PM   #7
colucix
LQ Guru
 
Registered: Sep 2003
Location: Bologna
Distribution: CentOS 6.5 OpenSuSE 12.3
Posts: 10,509

Rep: Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976
Quote:
Originally Posted by dennismonsewicz View Post
So if user is logged in and they run the script it tries to send the email to user@workaddy.com
That's weird, but it's difficult to find out the reason without viewing the actual script. Re-reading your previous post, I have some doubt on the correctness of the command line. First, uuencode should send its output to standard output in order to pipe it to the mail command (correct me if I'm wrong). Second, the option -a 'FROM:test@test.com' looks strange to me, but maybe it depends on the specific mail client used.

In the meanwhile, let me to suggest an alternative method which uses another "uu" application called uudeview. I'm used to send binary attachments in the following way and I've never had an issue:
Code:
recipient="pippo@null.domain"
subject="This is the subject"
sender="pluto@null.domain"

/usr/bin/uuenview -m "$recipient" -f "$sender" -s "$subject" -a attachment_file_name << EOF

This is the e-mail body.

Greetings,
Alex

EOF
Note that uudeview is the name of the package, whereas the encoding command is uuenview. Moreover uuenview takes care to pipe the mail to sendmail for you (without need to explicitly pipe it to the mail command). Just my

A little hint: I hope the e-mail you wrote in post #1 is not real, otherwise better to change it into a fictional address!
 
  


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
uuencode how to mail attachments question boyd98 Linux - Software 2 04-02-2009 04:00 PM
uuencode sherimm Linux - Software 4 01-22-2009 02:47 AM
Problem using uuencode hashbangbinbash Linux - Newbie 2 04-17-2008 09:54 AM
does fedora have uuencode? sorno Linux - Newbie 2 08-07-2005 07:40 AM
uuencode Berhanie Programming 4 11-27-2004 07:33 PM


All times are GMT -5. The time now is 04:49 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