从shell脚本发送一封电子邮件,其中包含可点击的链接

时间:2016-04-27 08:37:04

标签: shell unix ksh informatica informatica-powercenter

我想从<table style="width:100%;" frameborder="0"> <tr> <th>Element </th> <th>Element name</th> <th>Element ID</th> </tr> <tr> <td></td> <td></td> <td></td> </tr> <tr> <td></td> <td></td> <td></td> </tr> </table> 发布会话命令发送电子邮件,以便电子邮件中包含可点击的链接..

以下是我的代码:

informatica

但是我在执行脚本时遇到错误:

  

第11行:第20行的语法错误:`&lt;'意想不到

如果我在没有html的情况下尝试它,那么我会在没有链接的邮件中获得纯文本。 请注意,该位置是文件位置,而不是Web链接。

可以在#Name: rse_outbound_feeds_email_Invoice_link_mail # #Author: Blossom Correia # #Date created (mm/dd/yyyy): 04/26/2016 # #Purpose: This script will send an email with the link to the user for Email invoiced report # ################################################################################################### Target_dir=/data/rse_outbound_feeds/tgtfiles File_name=Emailed_invoice_`date '+%Y%m%d'`.csv Mail_to_recipients=correia.blossom@rexelholdingsusa.com #checking size of the Target file if [ -s $Target_dir/$File_name ] then echo "Hi," > invoice_mail.html echo " " >> invoice_mail.html echo "Please click on the link below for the email events latest Email_Invoice file" >>invoice_mail.html echo "<html><body><a href="\\corp-serv3.rexelusa.com\Dev\Business Intelligence\Reports\Emailed_Invoices\">Link text</a></body></html>">>invoice_mail.html echo "\\corp-serv3.rexelusa.com\Dev\Business Intelligence\Reports\Emailed_Invoices\ " >> invoice_mail.html echo " " >> invoice_mail.html echo "NOTE: This is auto generated email with an unmonitored mailbox. Please do not reply to this email." >> invoice_mail.html echo " " >> invoice_mail.html echo "Thanks," >> invoice_mail.html echo "RHUSA Business Intelligence Support Team." >> invoice_mail.html mutt -s "eServ Rexel- Emailed Invoice Report" ${Mail_to_recipients} -y< invoice_mail.html else exit 0 fi rm -f /data/rse_outbound_feeds/scripts/invoice_mail.html # mv $Target_dir/$File_name /ff1_arc/rse_outbound_feeds/inbfiles/ #end of the script 发布会话命令或电子邮件任务中将其作为链接发送吗?

1 个答案:

答案 0 :(得分:0)

要解决此问题,您可以使用我在此处发现的great site,并将代码粘贴到其中以进行错误检查。

您使用href的主要引用字符串不正确+您必须使用\

转义\字符

试试这个:

#Name: rse_outbound_feeds_email_Invoice_link_mail                         #
#Author: Blossom Correia                                  # 
#Date created (mm/dd/yyyy): 04/26/2016                                    #
#Purpose: This script will send an email with the link to the user for Email invoiced report      #
###################################################################################################


Target_dir=/data/rse_outbound_feeds/tgtfiles
File_name=Emailed_invoice_`date '+%Y%m%d'`.csv
Mail_to_recipients=correia.blossom@rexelholdingsusa.com

 #checking size of the Target file
 if [ -s $Target_dir/$File_name ]
 then
    echo "<html><body>Hi," > invoice_mail.html
    echo "<br>            " >> invoice_mail.html
    echo "Please click on the link below for the email events latest Email_Invoice file" >>invoice_mail.html
    echo "<a href=\"\\\\\\\\corp-serv3.rexelusa.com\\Dev\\Business Intelligence\\Reports\\Emailed_Invoices\">Link text</a>" >>invoice_mail.html
    echo "<br>            " >> invoice_mail.html
    echo "NOTE: This is auto generated email with an unmonitored mailbox. Please do not reply to this email." >> invoice_mail.html
    echo "<br>            " >> invoice_mail.html
    echo "Thanks," >> invoice_mail.html
    echo "<br>            " >> invoice_mail.html
    echo "RHUSA Business Intelligence Support Team.</body></html>" >> invoice_mail.html
        mutt -s "eServ Rexel- Emailed Invoice Report" ${Mail_to_recipients} -y< invoice_mail.html    

    else
    exit 0
fi
rm -f /data/rse_outbound_feeds/scripts/invoice_mail.html

或者您的新要求:

mutt -s "eServ Rexel- Emailed Invoice Report" ${Mail_to_recipients} -y< EmailInvoice.html

一个人应该工作......