如何在短信和电子邮件中发送 url 并省略 html 标签?

问题描述

我正在尝试使用 postfix 发送电子邮件和短信。我有以下代码

#!/bin/bash
#DIR_Contents='dir /temp/Stripped\ Files/$(date +'%Y-%m-%d')'
#DIR_Contents=`ls -1a /temp/Stripped\ Files/$(date +'%m-%d-%y')`
Working_Dir=/temp/Stripped%20Files/$(date +'%m-%d-%y');
Prefix_web="http://voncloft.dnsfor.me";
EMAIL_FROM="user@xmz.com";
EMAIL_TO="user@abc.com";
EMAIL_TO2="2225550690@phoneservice.com";
#DIRTOSCAN="/home /temp";
cd /temp/Stripped\ Files/$(date +'%m-%d-%y')
#DIR_Contents="<html><BODY>"
text_begin="New Files \n\n";
for file in *;
do
if [ $file != "secondary.PHP" ];
then
    #DIR_Contents=$DIR_Contents$file"<br>";
    DIR_Contents=$DIR_Contents"<a href=http://voncloft.dnsfor.me$Working_Dir/$file>$file</a><br><br>";
        text_message=$text_message$file"\n\n";
        #text_message=$text_message$DIR_CONTENTS"\n\n";
        #echo $text_message
fi
done


echo -e "Content-Type: text/html"$DIR_Contents | mail -r "$EMAIL_FROM" "$EMAIL_TO";
echo -e  $DIR_Contents | mail -r "$EMAIL_FROM" "$EMAIL_TO2";

我的回复结果是整个电子邮件和文本是:

"<Content-Type: text/html<a href=url.com>Click Me</a><br><br>

我只想要一条短信,上面写着:点击我并发布到一个网址,电子邮件也是如此。

我不知所措...使用 mail -a 格式的“text/html”只是说“找不到文件

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)