Improve company productivity with a Business Account.Sign Up

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

Emailing file as an attachment

I am having hard time figuring out how to send an output file as attachment.

My environment:
Generating a sql output - output.csv file
Trying to send it as attachment in outlook mail. Not succeeding. Its sending some junk chars and that too in body of message like:

begin 644 output.200607131533.csv
M14U"05)1("`@("`@("`@("`@("`@("`@("`@("`@("`@("`@("`@("`@("`@
M("`@("`@("`@("`@("`@("`@("`@("`@("`@("`@("`@("`@("`@("`@("`@
@-C<Y,C@P(%5N;"!#86QL<R!4;R!(;VUE($]R($)U<PH@
`
end

OS : HP UX

My shell script looks like :

Connect="report/report
Addr="email@mail.com"
File="output"

sqlplus -s $Connect @report.sql

ux2dos -ascii $File.csv  $File.csv  2>> /dev/null

( uuencode $File.csv $File.$(date).csv
) | mailx -s "Report $(date)" $Addr

Can you guys correct me if I am missing any thing.
0
csreeni
Asked:
csreeni
1 Solution
 
MikeOM_DBACommented:

Try this:

cat $File.csv | uuencode  $File.$(date).csv | mailx -s "Report $(date)" $Addr


0
 
MikeOM_DBACommented:

Or also:

uuencode  $File.$(date).csv <$File.csv | mailx -s "Report $(date)" $Addr

0
 
csreeniAuthor Commented:
No luck. I am still receiving junk, but not an attachment.
0
Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

 
TintinCommented:
Perhaps Exchange is configured to only recognise MIME encoded mail and not uuencoded mail.

Try loading mimetools on your server and MIME encode the CSV file.
0
 
yuzhCommented:
For M$ PC mail client, it is better to use mutt to do the job, you can download the
binary package from:
http://hpux.cs.utah.edu/hppd/hpux/Networking/Mail/mutt-1.5.11/

If you use uuencode to send the mail, at the other end, the user has to save the mail as a file and then use uudecode to extract the attachmemt.

Please read the answer in http:Q_20305167.html  to learn more details.
0
 
MikeOM_DBACommented:

I think its the 'date' function, try this:

uuencode  $File.$(date +%YYYYMMDD).csv <$File.csv | mailx -s "Report $(date)" $Addr



0
 
MikeOM_DBACommented:

Or this:

uuencode  ${File}_$(date +%YYYYMMDD).csv <${File}.csv | mailx -s "Report $(date)" $Addr
0
 
MikeOM_DBACommented:

Or even this:

uuencode  "$File.$(date).csv" <$File.csv | mailx -s "Report $(date)" $Addr
0
 
rockiroadsCommented:
The comment from yuzh might be worth considering.
I couldnt see much wrong with your syntax, so had a quick check
http://www.shelldorado.com/articles/mailattachments.html

For File attachments with MIME, it recommends using mutt

0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Get expert help—faster!

Need expert help—fast? Use the Help Bell for personalized assistance getting answers to your important questions.

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