mailx on solaris - How to add mail body


 
Thread Tools Search this Thread
Operating Systems Solaris mailx on solaris - How to add mail body
# 1  
Old 08-07-2008
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  
Old 08-07-2008
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  
Old 08-07-2008
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  
Old 08-07-2008
Tools 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  
Old 08-07-2008
CPU & Memory

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!
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Mailx with attachment and message body

i have to attach the 'body in the email' along with attachment below code is throwing errors, how can i do it ? here body file contains message, it should display in email, please help i am using HP-UX (cat body ;) (uuencode attch1 attch1 ;) | mailx -m -s "testing" "abc@gmail.com" ... (4 Replies)
Discussion started by: only4satish
4 Replies

2. Shell Programming and Scripting

Need to print body of content using mailx

Hi, I'm a perl developer. I need to attach a file from my perl cgi script and send mail to our users whoever using our website. I have used mailx command to attach a file.. it is working fine for me. The problem I'm facing is I'm not getting body of the mail. I have a function called... (0 Replies)
Discussion started by: bheeshmaraja
0 Replies

3. Shell Programming and Scripting

The body of the Email -- mailx

Hi, I am using mailx command to send an email and i took the body of the email from a file, mailx -r gtt.org -s "Status Report " ss@org.com < $ProcessStatisticsFile but now i want to declare the body of the email in the command itself. I have tried with the following command but... (4 Replies)
Discussion started by: chinnu01
4 Replies

4. UNIX for Dummies Questions & Answers

Mailx empty body message

Hi, Is there a way to suppress this message? Null message body; hope that's ok My email string is: mailx -s "This is my subject" myemail@domain.com < /dev/null It's just an annoyance to me that I would like see go away. (3 Replies)
Discussion started by: bbbngowc
3 Replies

5. Shell Programming and Scripting

send attachment and body in one mail using mailx

Hi, Our requirement is to send an attachment and content in a single mail. I am using the below command to send attachement. --------------------- (uuencode $exp_file $exp_file) |mailx -s "$email_subject" $EmailRecipients -------------------- I m not able to send any message in the... (4 Replies)
Discussion started by: ashwin3086
4 Replies

6. UNIX for Dummies Questions & Answers

mailx and html body messages

Hi, I'm working on Solaris 9 (SPARC) and I like to send an html body message to our users when something happen. The problem is that I can't find how to give mime type information with mailx. To be recognized as html I need to put in email header this information: Mime-Version: 1.0... (2 Replies)
Discussion started by: gbagagli
2 Replies

7. UNIX for Advanced & Expert Users

display HTML text in body using unix mailX ????

display HTML text in body using unix mailX ????Hello, could any one tell me how to display text in html layout by sending a file using mailx command in unix. i know to use mailx : mailx -s "SUBJECT" user.name@domail.com < file_name.txt instead of txt file i want to send html page and... (8 Replies)
Discussion started by: sparan_peddu
8 Replies

8. AIX

Send mail attachments and have a mail body

Hi, How can I send mail attachments from shell script (AIX) and have a mail body as well ? Thanks in advance. (1 Reply)
Discussion started by: shibajighosh
1 Replies

9. UNIX for Dummies Questions & Answers

Mailx : can we have the body to be a binary file ?

Hi I am totally dummy as far as UNIX is concerned, so please apologize. I was just given the syntax to send multiple attachments with a body.txt message, it works great and we use it a lot. Now, my question is : can we have the body to be a Binary file (like a Word Document for example)? ... (5 Replies)
Discussion started by: CKIRCH
5 Replies

10. UNIX for Dummies Questions & Answers

MAILX Body containing SQL results

I have a KSH script that runs a SQL script, then sends an email to me indicating that it's completed. I would like to modify it so that the body of the email will contain a count of the number of records Added, Changed, Deleted as a result of the SQL script. Here's what I was trying, but it's... (2 Replies)
Discussion started by: dstinsman
2 Replies
Login or Register to Ask a Question