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 01:23 AM
Send mail attachments and have a mail body shibajighosh AIX 1 04-18-2008 01:54 PM
Mailx : can we have the body to be a binary file ? CKIRCH UNIX for Dummies Questions & Answers 5 01-01-2008 06:33 PM
mailx: concatenating strings for message body (KSH) rockysfr Shell Programming and Scripting 1 07-29-2007 08:12 AM
MAILX Body containing SQL results dstinsman UNIX for Dummies Questions & Answers 2 10-05-2006 11:12 PM

Reply
 
Submit Tools LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 08-07-2008
Registered User
 

Join Date: Dec 2007
Posts: 8
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.
Reply With Quote
Sponsored Links
  #2 (permalink)  
Old 08-07-2008
vgersh99's Avatar
Moderator
 

Join Date: Feb 2005
Location: Boston, MA
Posts: 4,534
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
Reply With Quote
  #3 (permalink)  
Old 08-07-2008
Registered User
 

Join Date: Dec 2007
Posts: 8
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.
Reply With Quote
  #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,293
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.
Reply With Quote
  #5 (permalink)  
Old 08-07-2008
Registered User
 

Join Date: Dec 2007
Posts: 8
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!
Reply With Quote
Google The UNIX and Linux Forums
Reply

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:




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


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
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

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66