简体   繁体   English

额外! 通过Shell脚本发送邮件时登录电子邮件正文

[英]Extra ! sign in email message body while sending mail through shell script

I am sending emails through shell script, in which I get message body from a text file. 我正在通过Shell脚本发送电子邮件,在该脚本中我从文本文件中获取消息正文。 Issue comes when my disclaimer goes long, it starts getting extra ! 当我的免责声明过长时,问题就来了! sign in between. 在两者之间登录。

Please suggest me to remove that without shortening or giving extra lines between the disclaimer. 请建议我删除该内容,不要在免责声明之间缩短或添加多余的空格。 Let me know if you need any details. 让我知道您是否需要任何详细信息。


Needed(say) : 需要(说)

I am sending emails through shell script, in which I get message body from a text file. 我正在通过Shell脚本发送电子邮件,在该脚本中我从文本文件中获取消息正文。 Issue comes when my disclaimer goes long, it starts getting extra ! 当我的免责声明过长时,问题就来了! sign in between. 在两者之间登录。 Please suggest me to remove that without shortening or giving extra lines between the disclaimer. 请建议我删除该内容,不要在免责声明之间缩短或添加多余的空格。 Let me know if you need any details. 让我知道您是否需要任何详细信息。

Output in mail : 邮件输出

I am sending emails through shell script, in which I get message body from a text file. 我正在通过Shell脚本发送电子邮件,在该脚本中我从文本文件中获取消息正文。 Issue comes when my disclaimer goes long, it starts getting extra ! 当我的免责声明过长时,问题就来了! sign in between. 在两者之间登录。 Please suggest me to remove that without shortening or giving e!xtra lines between the disclaimer. 请建议我删除该内容,而不要在免责声明之间缩短或加倍! Let me know if you need any details. 让我知道您是否需要任何详细信息。

Here you can see that we are getting ! 在这里,您可以看到我们越来越! sign in extra word. 登录多余的单词。 Just keep the body long (sry I couldn't provide you the actual text), and you will get the ! 只要保持身体较长(对不起,我无法为您提供实际的文字),您将获得! sign. 标志。

Code I am using - to read from text file 我正在使用的代码 -从文本文件读取

EMAILMSG=$(cat $2)   # $2 is path of text file

to send email 发送电子邮件

(echo -e $EMAILMSG;) | mailx -s "$SUBJECT" -b "abc@abc.com" $EMAIL -r $MAILBCC

I think this will help you to understand the situation. 我认为这将帮助您了解情况。 Please let me know anyone need further details. 请让我知道有人需要更多详细信息。

I found this: Random exclamation mark in email body using CDO 我发现了这一点: 使用CDO的电子邮件正文中出现随机感叹号

It seems to indicate long lines are the problem. 似乎表明行很长是问题所在。 Try this using fold to wrap lines: 尝试使用fold换行:

fold -s "$2" | mailx -s "$SUBJECT" -b "abc@abc.com" "$EMAIL" -r "$MAILBCC"

Style recommendations: 风格建议:

  1. don't use $ALL_CAPS_VARS ( here 's why not) 不要使用$ALL_CAPS_VARS就是为什么不这样做)
  2. always quote your "$vars" except when you know exactly when not to. 总是引用您的"$vars"除非您确切知道什么时候不这样做。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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