更新时间:2023-01-09 12:41:53
将您的引号引起来,即:
Swap your quotes around, i.e.:
$link = "<a href='http://tsturl/detail.aspx?reqID=$reqID'>$ReqID</a>"
或者这样做:
$link = '<a href="http://tsturl/detail.aspx?reqID=$reqID">$ReqID</a>'
$link = $ExecutionContext.InvokeCommand.ExpandString($link)
在您的评论之外,如果您希望邮件正文呈现为HTML,从而显示一个链接,那么您需要告诉您的邮件客户端该正文是HTML. $ link
只是一个普通的旧字符串,并且不知道它是HTML.
Further to your comment, if you want the mail body to render as HTML, an thus display a link, then you'll need to tell your mail client that the body is HTML. $link
is just a plain old string and doesn't know that it's HTML.
从您的上一个问题中,我猜你是重新使用 Send-MailMessage cmdlet.如果是这样,则需要指定 -BodyAsHtml
开关.
From your previous question, I'm guessing you're using the Send-MailMessage cmdlet. If so then you need to specify the -BodyAsHtml
switch.