I use maix command to sent mails.
i can sent only plain text mails.
Unable to sent mails in html format.
while sending mails in html format, the received mail has the html code only.
I use maix command to sent mails.
i can sent only plain text mails.
Unable to sent mails in html format.
while sending mails in html format, the received mail has the html code only.
I think that you will have to use sendmail instead of mailx to send inline html, e.g....
#!/usr/bin/ksh
export MAILTO="spam@ebay.com"
export CONTENT="filename.html"
export SUBJECT="Subject"
(
echo "Subject: $SUBJECT"
echo "MIME-Version: 1.0"
echo "Content-Type: text/html"
echo "Content-Disposition: inline"
cat $CONTENT
) | /usr/sbin/sendmail $MAILTO
thankx
it worked with sendmail..
when i tried the similiar way in mailx by
( echo "Content-Type: text/html"; cat <<filename.htm>>; ) | mailx -s 'xx' xx@x.com
it give the html source code insists of html formatted file.
Is that not possible to convert sendmail to maix ...?
In sendmail the from address can be change, but in mailx the from address remains the user login address, I need to do with mailx only.
The mailx utility is a front-end for sendmail.
It is not possible to use mailx to send inline html, but you can attach html documents.
Fine.
After sending the mail by SendMail,
when i saw the mail, the From address was there.
But the To Address is not there at the receipt end.
How to get the to address in the maix box and also the cc(if any).
You should look at the manual pages for sendmail. I have only included the bare minimum to get you started. You can add headers like "To:", "Cc:", "Bcc:", "Apparently-To:", etc. This can be done manually or via the -O options, e.g. -O "NoRecipientAction=add-to"
Hi All,
With sendmail command i am able to send HTML page as a body of mail but not able to attach PDF file as an attachment in the same mail...
Could u pls help me resolving this problem ....
Pls see the code which i am using ....
Rgds,
Nilesh
mailfrom="abcd@emirates.com"
mailto="xyz@emirates.com"
content="XXEGAR_EK_SOA_Email.htm"
subject="EK SOA with send mail"
attachment="/trident1/applprod/erpprodcomn/feeders/ar_statement/out/DDP008_300905.zip"
cd /trident1/applprod/erpprodappl/xxegfin/11.5.0/bin
(echo "From: $mailfrom"
#echo "To: $mailto"
echo "subject: $subject"
echo "MIME-Version: 1.0"
echo "Content-Type: text/html"
echo "Content-Disposition: inline"
cat /trident1/applprod/erpprodappl/xxegfin/11.5.0/bin/$content)> ./file1
uuencode $attachment $attachment|sendmail $mailto < ./file1
Change the last two lines. From...
cat /trident1/applprod/erpprodappl/xxegfin/11.5.0/bin/$content)> ./file1
uuencode $attachment $attachment|sendmail $mailto < ./file1
...to...
cat /trident1/applprod/erpprodappl/xxegfin/11.5.0/bin/$content
uuencode $attachment $attachment ) | sendmail $mailto
Hi,
Thanks for ur quick input....
We modified the script as u mentioned .... HTML file is coming (Opening) properly in email body but below mail body PDF file (Which we r sending as attachment) is opening as garbage characters...
Rgds,
Nilesh
mailfrom="S259210@emirates.com"
mailto="S339824@emirates.com"
content="XXEGAR_EK_SOA_Email.htm"
subject="EK SOA with send mail"
attachment="/trident1/applprod/erpprodcomn/feeders/ar_statement/out/DDP008_300905.zip"
cd /trident1/applprod/erpprodappl/xxegfin/11.5.0/bin
(echo "From: $mailfrom"
#echo "To: $mailto"
echo "subject: $subject"
echo "MIME-Version: 1.0"
echo "Content-Type: text/html"
echo "Content-Disposition: inline"
cat /trident1/applprod/erpprodappl/xxegfin/11.5.0/bin/$content
uuencode $attachment $attachment) | sendmail $mailto
All I see in attachment is a zip file..
attachment="/trident1/applprod/erpprodcomn/feeders/ar_statement/out/DDP008_300905.zip"
is the pdf file zipped in this archive..? make sure your zip is not corrupt.. or try sending the pdf itself.. rather than zipping it..
Hi Ambikesh,
Thanks for ur reply...
We r zipping a PDF files because some of the PDF files are more then 1 or 1.5 MBs and we are not able to send it by mail...
We checked, PDF file is not corrupted after zipping....
Rgds,
Nilesh
Are you getting email with an attachment or the email itself shows some garbage characters..?
Hi,
We got the solution for the sending PDF file as attachment and html as mail body from unix send mail...
I am able to open attached PDF file from my Hotmail, Yahoo id's but getting error in Gmail.com..
Error is "Adobe Reader could not open PDF file because it is either not a supported file type or because the file has been corrupted(for example, it was sent as an email attachment and wasn't correctly decoded ) "
thanks,
Nilesh
/Unix shell******************/
mailfrom=$1
#echo 'mailfrom :'$mailfrom
mailto=$2
#echo 'mailto :'$mailto
subject=$3
#echo 'subject :'$subject
content=$4
#echo 'content :'$content
attachment=$5
#echo 'attachment :'$attachment
Unixfile_Dir=$6
#echo 'Unixfile_Dir :'$Unixfile_Dir
sed_command=$7
echo 'sed_command :'$sed_command
file_name=$8
echo 'file_name :'$file_name
cd $Unixfile_Dir
(echo "MIME-Version: 1.0"
echo "From: Emirates Group Credit Control <$mailfrom>"
echo "To: $mailto"
echo "subject: $subject"
echo 'Content-Type: multipart/mixed; boundary="-"'
echo "---"
echo "Content-Type: text/html"
echo "Content-Disposition: inline"
)> XXEGHTMLFORMATFILE
(echo "---"
echo "Content-Type: application/octet-stream; name=$file_name"
echo "Content-Transfer-Encoding: x-uuencode"
echo "Content-Disposition: inline; filename=$file_name"
echo "---"
)> XXEGPDFFORMATFILE
cat $Unixfile_Dir$content | sed s/"$sed_command"/g > XXEGAR_EK_SOA_Email_NEW.htm
uuencode $attachment SOA_Attachment > SOA_Attachment
cat XXEGHTMLFORMATFILE XXEGAR_EK_SOA_Email_NEW.htm XXEGPDFFORMATFILE SOA_Attachment|sendmail $mailto
echo Done, mail sent.
/***********************************************/
Hi Nilesh
I am trying to learn something from ur code. Me too have to send an HTML content as Message Body. I may also have attachment of any DOC type..eg .xls, .pdf, .rtf etc. though unlike u I do not have a .zip file as an attachment.
I tried to follow ur code and managed the following code:
FILE_NAME="test.xls"
(
echo "From:Amruta Pitkar"
echo "To:apkar@yahoo.com"
echo "Subject:Ebill Department Trial"
echo "Cc:uer@hotmail.com"
echo "MIME-Version: 1.0"
echo 'Content-Type:multipart/mixed; boundary="-"'
echo "-----"
echo "Content-Type:text/html"
echo "Content-Disposition:inline"
)>AHTMLFILE
(
echo "----"
echo "Content-Type:application/octet-stream;name=$FILE_NAME"
echo "Content-Transfer-Encoding:x-uuencode"
echo "Content-Disposition:inline;filename=$FILE_NAME"
echo "-----"
)>AXLSFILE
uuencode test.xls MyAttach > MyAttach
cat AHTMLFILE e28931.htm AXLSFILE MyAttach | sendmail apkar@yahoo.com
echo "Done mail sent"
But I dont see the message body, neither the Attachment.
Can u guide me so ?
Thanks
Amruta Pitkar
Hi amruta,
I have the same results as you... no body and no attachment!!
Did you manage to fix the problem? If yes, what should be change ?
Thank you in advance fo your help.
Dejan.
Hello
I have solved the issue in the following manner : . the following shell script sends text/html as message body, and pdf files as attachment
#Create the Send Options
subject="Subject Line"
#Create header part of the email
echo "From:""${sendername}""<"${senderaddress}">">>${tempfile}
echo "To:"${emailid}>>${tempfile}
echo "Mime-Version:1.0"${version}>>${tempfile}
echo "Content-Type:Multipart/mixed;boundary=Message-Boundary-"${boundary}>>${tempfile}
echo "Subject:"${subject}>>${tempfile}
#Delivery Receipt is returned here
echo "Return-Receipt- To:""${sendername}""<"${senderaddress}">">>${tempfile}
echo "Message-Id:<"${messid}"."${senderdomain}>>${tempfile}
echo "">>${tempfile}
echo "">>${tempfile}
echo "--Message-Boundary-"${boundary}>>${tempfile}
echo "Content-type:text/html;charset=US-ASCII">>${tempfile}
echo "Content-transfer-encoding: 7BIT">>${tempfile}
echo "Content-Disposition:inline">>${tempfile}
echo "Content-Description: Read Me First">>${tempfile}
echo "">>${tempfile}
echo "">>${tempfile}
#Create Msg body part of the email file
{
while read line_data
do
echo "${line_data}""
">>${tempfile}
done
}<${emailfile}
#uuencode the attachment
echo "ATTACHMENTS"
echo "--Message-Boundary-"${boundary}>>${tempfile}
echo "Content-type:Application/Octet-Stream;name=${ATTACHFILE};type=Binary">>${tempfile}
echo "Content-disposition:inline;filename=${ATTACHFILE}">>${tempfile}
echo "Content-transfer-encoding: X-UUencode">>${tempfile}
echo "--Message-Boundary-"${boundary}>>${tempfile}
echo "">>${tempfile}
uuencode ${ATTACHFILE} ${ATTACHFILE} >>${tempfile}
##Send temp file to sendmail
/usr/lib/sendmail ${emailid} < ${tempfile};EXITSTATUS=$?
Thanks
Amruta Pitkar
Hi Ygor,
I tried to use the same code for command elm in HP9000 environment, but it does not work. Can you help? Thanks.
How does it not work?