Send Mail with attachment and a body | Unix Linux Forums | How do I send email?

  Go Back    


How do I send email? Learn how to send a UNIX or Linux email attachment from the command line.

Send Mail with attachment and a body

How do I send email?


 
 
Thread Tools Search this Thread Display Modes
    #1  
Old 04-24-2004
manojram manojram is offline
Registered User
 
Join Date: Aug 2003
Last Activity: 14 August 2004, 1:50 AM EDT
Posts: 5
Thanks: 0
Thanked 1 Time in 1 Post
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
The Following User Says Thank You to manojram For This Useful Post:
Suresh Podishet (08-08-2013)
Sponsored Links
    #2  
Old 04-24-2004
Perderabo's Avatar
Perderabo Perderabo is offline Forum Staff  
Unix Daemon (Administrator Emeritus)
 
Join Date: Aug 2001
Last Activity: 28 October 2014, 3:35 PM EDT
Location: Ashburn, Virginia
Posts: 9,930
Thanks: 64
Thanked 437 Times in 261 Posts
See this thread.
Sponsored Links
    #3  
Old 04-25-2004
manojram manojram is offline
Registered User
 
Join Date: Aug 2003
Last Activity: 14 August 2004, 1:50 AM EDT
Posts: 5
Thanks: 0
Thanked 1 Time in 1 Post
MySQL

Thank you very much.
    #4  
Old 04-26-2004
Ygor's Avatar
Ygor Ygor is offline Forum Advisor  
Advisor
 
Join Date: Oct 2003
Last Activity: 2 May 2014, 7:14 AM EDT
Location: 54.23, -4.53
Posts: 1,801
Thanks: 1
Thanked 112 Times in 98 Posts
Syntax is:
Code:
(  cat body.txt 
   uuencode pic.jpg pic.jpg
) | mailx -s "subject" abc@xyz.com

The Following User Says Thank You to Ygor For This Useful Post:
wznoinski (08-17-2011)
Sponsored Links
    #5  
Old 04-26-2004
Perderabo's Avatar
Perderabo Perderabo is offline Forum Staff  
Unix Daemon (Administrator Emeritus)
 
Join Date: Aug 2001
Last Activity: 28 October 2014, 3:35 PM EDT
Location: Ashburn, Virginia
Posts: 9,930
Thanks: 64
Thanked 437 Times in 261 Posts
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.
Sponsored Links
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
unix mail body with attachment gautamadak Shell Programming and Scripting 5 07-14-2010 02:36 PM
send attachment and body in one mail using mailx ashwin3086 Shell Programming and Scripting 4 06-24-2010 12:39 AM
how to send an email with some body content and attachment balireddy_77 Shell Programming and Scripting 2 08-20-2008 06:33 AM
Command line/Script to send E-mail with HTML body and binary attachment G-Man AIX 3 04-18-2007 09:30 PM
AIX send mail with HTML message body and a binary attachment G-Man UNIX for Dummies Questions & Answers 4 03-22-2007 02:15 PM



All times are GMT -4. The time now is 12:40 PM.