windows 当正文包含回车符和换行符时,如何使用 blat 从命令行发送电子邮件?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/491898/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-15 11:54:13  来源:igfitidea点击:

How can I send an email from the command line using blat when the body contains carriage returns and line feeds?

windowsemailsmtpblat

提问by Mike Roosa

I have a windows server which sends emails to me through a BASIC program. If the message body contains carriage returns/line feeds then the email never finishes. Only the first line is sent to me. I tried replacing them with \n but that didn't help as the email came to me with the \n in it. Any ideas?

我有一个 Windows 服务器,它通过 BASIC 程序向我发送电子邮件。如果消息正文包含回车符/换行符,则电子邮件永远不会结束。只有第一行发送给我。我尝试用 \n 替换它们,但这没有帮助,因为电子邮件中带有 \n 。有任何想法吗?

Here is the command I'm using:

这是我正在使用的命令:

blat -to [email protected] -subject "[DEV] PO Detail Report" -body "Attached file
is ready for import.
From 01/01/09 to 01/29/09 
PO Status not egual to 'C'" -attach "C:\TXT\PODetail_26879.csv" -log
C:\EMAIL.LOG090129.TXT -timestamp'.

采纳答案by Keng

If you want to do it all inline use the '|' character

如果你想全部内联使用'|' 特点

-body 1st line|second line|third line

回答by Patrick Cuff

You can put the body in a text file and have blat send that:

您可以将正文放在文本文件中,然后让 blat 发送:

blat [text file here] -to [email protected] -subject "[DEV] PO Detail Report" -attach "C:\TXT\PODetail_26879.csv" -log
C:\EMAIL.LOG090129.TXT -timestamp'

回答by Admin

Just use Mail Alert Simple Mailer: https://sourceforge.net/projects/mail-alert/

只需使用邮件警报简单邮件程序:https: //sourceforge.net/projects/mail-alert/

MailAlert.exe -r [email protected] -b "@Your_Directory\File_with_Mail_Body.txt"

MailAlert.exe -r [email protected] -b "@Your_Directory\File_with_Mail_Body.txt"

You can also attach HTML file as an email body (remember to change PlaintextOnly=no in such a case).

您还可以附加 HTML 文件作为电子邮件正文(在这种情况下,请记住更改 PlaintextOnly=no)。