The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Dummies Questions & Answers > Answers to Frequently Asked Questions > How do I send email?
Google UNIX.COM


How do I send email? How do I send an mail attachment from the command line?

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
how to send an email with some body content and attachment balireddy_77 Shell Programming and Scripting 2 08-20-2008 03:33 AM
Command line/Script to send E-mail with HTML body and binary attachment G-Man AIX 3 04-18-2007 06:30 PM
AIX send mail with HTML message body and a binary attachment G-Man UNIX for Dummies Questions & Answers 4 03-22-2007 11:15 AM
How to send body in a mail rajendragora UNIX for Dummies Questions & Answers 6 06-29-2006 11:51 PM
sending mails with attachment and also some text in mail body guptan UNIX for Advanced & Expert Users 7 05-25-2006 03:17 AM

 
 
Submit Tools LinkBack Thread Tools Display Modes
  #1  
Old 04-24-2004
Registered User
 

Join Date: Aug 2003
Posts: 5
Send Mail with attachment and a body

Hi All,

I am using a shell script where i will be sending a mail with some text/message in it and an attachment.

The problem starts here:

i am not able to do both the things together. i.e., either i am able to send some message or an attachment.

the problem is not only with my script the mail command of unix is also outputing the same result. What i would like to know is, do i have to do some settings or please tell me what am i doing wrong.

from the command line i am using:

1.) uuencode pic.jpg pic.jpg | mail abc@xyz.com < body.txt

2.) (cat body.txt uuencode pic.jpg pic.jpg) | mail abc@xyz.com body.txt

and many more.

please help

Regards,
Manoj
Forum Sponsor
  #2  
Old 04-24-2004
Perderabo's Avatar
Unix Daemon
 

Join Date: Aug 2001
Location: Washington DC Area
Posts: 8,616
See this thread.
  #3  
Old 04-25-2004
Registered User
 

Join Date: Aug 2003
Posts: 5
Thumbs up

Thank you very much.
__________________
Regards,
Manoj
  #4  
Old 04-26-2004
Ygor's Avatar
Moderator
 

Join Date: Oct 2003
Location: -31.96,115.84
Posts: 1,248
Syntax is:
Code:
(  cat body.txt 
   uuencode pic.jpg pic.jpg
) | mailx -s "subject" abc@xyz.com
  #5  
Old 04-26-2004
Perderabo's Avatar
Unix Daemon
 

Join Date: Aug 2001
Location: Washington DC Area
Posts: 8,616
Quote:
Originally posted by Ygor
Syntax is:
Code:
(  cat body.txt 
   uuencode pic.jpg pic.jpg
) | mailx -s "subject" abc@xyz.com
I tried that on both HP-UX and SunOS. It works on SunOS but fails on HP-UX. I'm not sure how it will behave on other systems. On Linux, I didn't find a mailx, but I tried mail and it worked with that.

With HP-UX, I get a a large body that has the line line of body.txt immediately followed by a "begin 775 xyz.jpg" line. This is actually the behavior that I would expect. It works on SunOS because Sun's mailx is inspecting the mailed text and guessing at the placement of the mime headers. On SunOS, if I switch from mailx to mail, it no longer works.

This would seem to mean that if I intentionally wanted to include a uuencoded item in my body, that Sun's mailx would not let me.
Google The UNIX and Linux Forums
 

Thread Tools
Display Modes




All times are GMT -7. The time now is 04:58 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008. All Rights Reserved.Ad Management by RedTyger Visit The Complex Event Processing Blog

Content Relevant URLs by vBSEO 3.2.0