简体   繁体   中英

send mail with html code and add hyperlink

I'm creating a script which generates reports by querying information from various servers. Once the data is generated it does some calculations and creates a HTML output file (let's call it output.html), that I need to send via mailx/mail/sendmail.

Everything's fine till here, but let's suppose there is some more data that is in form of *.csv files. How do I create hyperlinks and link them to some fields (for eg. File1 , File2 ) in output.html file ?

The *.csv files will go as attachments in the same mail which will have output.html as the body.

The mail will be send from a Solaris 10 / RHEL 6 machine and I'm coding using only bash.

Please let me know if some more information is required.

So you want a hyperlink to the attached files? I don't think you can do that. You would typically either link to a hosted file OR attach it. Hyperlinks need a location to point to, and as an attachment, there isn't a set location to trigger the download/opening.

To link to a hosted file, just place it on your server and do a standard href hyperlink tag:

<a href="www.yoursite.com/files/file1">File 1</a>
<a href="mailto:vengets@gmail.com?Subject=Hello%20again" target="_top"> Contact ME </a>

You need a mail server for sending mail. Use some serverside scripting language like PHP .. for sending mail.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM