将newline字符附加到shell / linux for mail命令中的消息
将新线路附加到消息然后通过邮件发送的最佳方法是什么?
message=""
for f in $backupdir/*; do
message+="..."
done
echo "$message" | mailx -a 'Content-Type: text/html' -s "[Test]" email
我找到消息+=“消息” $'\ n'
,但是在Outlook中打开该邮件时,这有一些错误 我尝试了使用HTML标签的MailX,但这根本没有附加新行。
What is the best way to append a new line to a message and then send that per mail?
message=""
for f in $backupdir/*; do
message+="..."
done
echo "$message" | mailx -a 'Content-Type: text/html' -s "[Test]" email
i found message+="message"$'\n'
but this has some bugs when opening that mail in outlook
i tried mailx with html tag but this does not append a new line at all.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
原因是您要求Mailx将邮件编码到HTML中。
如果您需要HTML电子邮件,那么您需要
立即撰写HTML段落,如果您想发送纯文本消息,则常规的新线是可以的:
The reason for this is because you asks mailx to encode the mail into HTML.
if you need an HTML email, then you need to compose HTML paragraphs
Now if you want to send plain text messages, regular newlines are just fine:
使用HTML,您可以将
&lt; br /&gt; < /code>标记放在消息中。
Using HTML, you can put the
<br />
tag in the message.