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.
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.
mailx -s "Hi - This is mail subject" xyz@abc.com <<EOF
this is the body of the email
EOF
or
echo 'this is the body of the email' | mailx -s "Hi - This is mail subject" xyz@abc.com
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.
I have found that with mailx, you can either
include an attachment
uuencode "$file1" "$file1" | mailx -s "Subject line" me@you.com
OR
have a text message
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.
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:
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)..
(
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!