The UNIX and Linux Forums  


Go Back   The UNIX and Linux Forums > Operating Systems > SUN Solaris
.
google unix.com



SUN Solaris The Solaris Operating System, usually known simply as Solaris, is a free Unix-based operating system introduced by Sun Microsystems .

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
display HTML text in body using unix mailX ???? sparan_peddu UNIX for Advanced & Expert Users 8 07-30-2008 02:23 AM
Send mail attachments and have a mail body shibajighosh AIX 1 04-18-2008 02:54 PM
Mailx : can we have the body to be a binary file ? CKIRCH UNIX for Dummies Questions & Answers 5 01-01-2008 07:33 PM
mailx: concatenating strings for message body (KSH) rockysfr Shell Programming and Scripting 1 07-29-2007 09:12 AM
MAILX Body containing SQL results dstinsman UNIX for Dummies Questions & Answers 2 10-06-2006 12:12 AM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 08-07-2008
abovais abovais is offline
Registered User
  
 

Join Date: Dec 2007
Posts: 14
Question mailx on solaris - How to add mail body

hi,

Can anyone please tell me how to add some text in the mail body like I can add subject using the following syntax.

mailx -s "Hi - This is mail subject" xyz@abc.com

Many Thanks.
  #2 (permalink)  
Old 08-07-2008
vgersh99's Avatar
vgersh99 vgersh99 is online now Forum Staff  
Moderator
  
 

Join Date: Feb 2005
Location: Boston, MA
Posts: 5,131

Code:
mailx -s "Hi - This is mail subject" xyz@abc.com <<EOF
this is the body of the email
EOF

or

Code:
echo 'this is the body of the email' | mailx -s "Hi - This is mail subject" xyz@abc.com

  #3 (permalink)  
Old 08-07-2008
abovais abovais is offline
Registered User
  
 

Join Date: Dec 2007
Posts: 14
This served the purpose but not completely...
Because I want to send an HTML message with attached file and it shoud have a body...

I m trying the following code but its not working:

uuencode ${CSV_FILE1} ${CSV_NAME1} | (
echo "From:${SENDER_ADDRESS}"
echo "To: ${EMAIL_RECIPIENTS}"
echo "MIME-Version: 1.0"
echo "Content-Type: multipart/mixed;"
echo ' boundary="PAA08673.1018277622/server.domain.com"'
echo "Subject: Test Message"
echo ""
echo "This is a MIME-encapsulated message"
echo ""
echo "--PAA08673.1018277622/server.domain.com"
echo "Content-Type: text/html"
echo ""
echo "<HTML>
<BODY bgcolor=white>
<blockquote><font color=black>Please find the attached report.</font> <font co
lor=blue>Message by me</font> <font
color=blue>Body</font></blockquote>
</body>
</html>"
echo "--PAA08673.1018277622/server.domain.com"
) | mailx -t

It only sends the html mail but without any attachment.
  #4 (permalink)  
Old 08-07-2008
joeyg's Avatar
joeyg joeyg is offline Forum Staff  
modérateur
  
 

Join Date: Dec 2007
Location: Home of 17-time world champion Boston Celtics
Posts: 1,311
Cool mailx on Solaris

I have found that with mailx, you can either
include an attachment

Code:
uuencode "$file1" "$file1" | mailx -s "Subject line" me@you.com

OR
have a text message

Code:
mailx -s "Subject line" me@you.com <message.txt

BUT NOT BOTH.

Perhaps take a look at mutt - you will find references on this Forum and elsewhere.
  #5 (permalink)  
Old 08-07-2008
abovais abovais is offline
Registered User
  
 

Join Date: Dec 2007
Posts: 14
Arrow

Joeyg,

you can send both text and attachment with mailx.....
but the problem arises when you use the html text, the attached file get distorted...
like i m trying to send the mail using the following code:



Code:
echo "mail body" > tempfile
uuencode try.sh try.sh >> tempfile | mailx -s "Hi - This
is mail subject" user@domain.com < tempfile

Now if try the following code everything goes fine even in this case but the attachment contents get distorted and it can NOT be read (the attachment seems to get encoded)..


Code:
(
echo "MIME-Version: 1.0"
echo "Content-Type: mutipart/mixed;"
echo ' boundary="PAA08673.1018277622/server.domain.com"'
echo ""
echo "This is a MIME-encapsulated message"
echo ""
echo "--PAA08673.1018277622/server.domain.com"
echo "Content-Type: text/html"
echo ""
echo "<HTML>
<BODY bgcolor=red>
<blockquote>
<p><font color=black>Please find the attached report.</font></p><p> <font color=blue>Message by someone</font></p><p> <font color=blue>Body</font></p></blockquote>
</body>
</html>"
echo "--PAA08673.1018277622/server.domain.com"
) > temp

uuencode just.doc just.doc >> temp | mailx -s "Subject here" user@domain.com < temp


Please solve this error!
Closed Thread

Bookmarks

Tags
mail, mail body, mailx, mailx attachment, sun solaris

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

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 On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 10:44 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0