Unix Shell - shell script to e-mail an attachment (html file)

This is Interesting: Free IT Magazines  
Home > Archive > Unix Shell > September 2006 > shell script to e-mail an attachment (html file)





You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

Author shell script to e-mail an attachment (html file)
rajesh.vadde@gmail.com

2006-09-21, 7:29 pm

Hi all,

I need some help with unix shell scripts. i am trying to e-mail a html
file as an attachment. I am using this code:

rpt_mail=xyz@abc.com
file=/home/usrid/test.htm
subject=status report

do_mail()
{
cat ${file} | mailx -s "${subject}" ${rpt_mail}
}

do_mail


The problem with the above code is i am seeing all the html tags in the
body of the e-mail. I want to see the html page in the body of the
e-mail wthout any tags. Can any one know how to do this..

Thanks alot,
Raj

Xicheng Jia

2006-09-22, 1:41 am

rajesh.vadde@gmail.com wrote:
> Hi all,
>
> I need some help with unix shell scripts. i am trying to e-mail a html
> file as an attachment. I am using this code:
>
> rpt_mail=xyz@abc.com
> file=/home/usrid/test.htm
> subject=status report
>
> do_mail()
> {
> cat ${file} | mailx -s "${subject}" ${rpt_mail}
> }


If your 'mail' program supports '-a' option, then

mailx -a "Content-type: text/html;" -s "${subject}" "${rpt_mail}"

Xicheng

Dave Kelly

2006-09-22, 1:41 am

rajesh.vadde@gmail.com wrote:
> Hi all,
>
> I need some help with unix shell scripts. i am trying to e-mail a html
> file as an attachment. I am using this code:
>
> rpt_mail=xyz@abc.com
> file=/home/usrid/test.htm
> subject=status report
>
> do_mail()
> {
> cat ${file} | mailx -s "${subject}" ${rpt_mail}
> }
>
> do_mail
>
>
> The problem with the above code is i am seeing all the html tags in the
> body of the e-mail. I want to see the html page in the body of the
> e-mail wthout any tags. Can any one know how to do this..
>
> Thanks alot,
> Raj
>

What email client are you mailing to?
Luiz Henrique de Figueiredo

2006-09-22, 1:41 am

>I need some help with unix shell scripts. i am trying to e-mail a html
>file as an attachment.


Check out my matt script at http://www.tecgraf.puc-rio.br/~lhf/ftp/matt.tar.gz

--lhf
rajesh.vadde@gmail.com

2006-09-22, 1:41 am

Thank for the reply. I am trying to e-mail this html file from unix to
ms outlook.


Dave Kelly wrote:
> rajesh.vadde@gmail.com wrote:
> What email client are you mailing to?


PDreyer

2006-09-22, 7:27 am



rajesh.vadde@gmail.com wrote:
> Hi all,
>
> I need some help with unix shell scripts. i am trying to e-mail a html
> file as an attachment. I am using this code:
>
> rpt_mail=xyz@abc.com
> file=/home/usrid/test.htm
> subject=status report
>
> do_mail()
> {
> cat ${file} | mailx -s "${subject}" ${rpt_mail}
> }
>
> do_mail
>
>
> The problem with the above code is i am seeing all the html tags in the
> body of the e-mail. I want to see the html page in the body of the
> e-mail wthout any tags. Can any one know how to do this..
>
> Thanks alot,
> Raj


mailx -t <<EOF
To: ${rpt_mail}
Subject: ${subject}
Mime-Version: 1.0;
Content-Type: text/html; charset="ISO-8859-1";
Content-Transfer-Encoding: 7bit;

$(cat ${file})
EOF

rajesh.vadde@gmail.com

2006-09-22, 1:23 pm

Thanks for your comments. But none of the code seems working. any
ideas??


PDreyer wrote:
> rajesh.vadde@gmail.com wrote:
>
> mailx -t <<EOF
> To: ${rpt_mail}
> Subject: ${subject}
> Mime-Version: 1.0;
> Content-Type: text/html; charset="ISO-8859-1";
> Content-Transfer-Encoding: 7bit;
>
> $(cat ${file})
> EOF


Sponsored Links






Free braindumps | Software forum | Database administration forum

Copyright 2003 - 2008 webservertalk.com