我在我的构建脚本中有一个目标,该目标将发送一封电子邮件,并附上一个模块的svn变更详情。
如果我硬编码一个单一的电子邮件地址,这个功能是可行的,但现在我想要向多个开发人员发送电子邮件,但脚本却失败了。以下是代码:
<Target Name="MailInformationUpdate" DependsOnTargets="ZipArtifact" Condition="!Exists('BUILD_IS_PERSONAL')">
<ReadLinesFromFile File="$(BuildDir)\$(recipientListFileName)">
<Output PropertyName="Recipients" TaskParameter="Lines"/>
</ReadLinesFromFile>
<Mail SmtpServer="$(smptServer)"
To="@(Recipients)"
From="$(senderEmail)"
Body="Attached is a list of the changes made since the last release. "
Subject="This module has been updated. You may wish to update." Attachments="$(BuildDir)\Builds\$(svnChangeFileName)"
/>
</Target>
如果我将“收件人”一栏更改为$(Recipients),则列表中的第一个人将收到电子邮件,其他地址将不会收到电子邮件。
然后,我将“收件人”一栏更改为@(Recipients),因为我认为这样可能会循环发送给每个收件人。但是没有这样的运气!!!我收到了错误消息。
Emailing "{0}".
<path> error : A recipient must be specified.
我读取的文件只是一个文本文件,格式为(emailAddress1),(emailAddress2),等等。