Email Class | MSBuild Extension Pack Help 4.0.12.0 |
Valid TaskActions are:
Send (Required: SmtpServer, MailFrom, MailTo, Subject Optional: Priority, Body, Format, Attachments, UseDefaultCredentials, UserName, UserPassword, Port, EnableSsl)
Remote Execution Support: No
Inheritance Hierarchy
MSBuild.ExtensionPackBaseTask
MSBuild.ExtensionPack.CommunicationEmail
Namespace: MSBuild.ExtensionPack.Communication
Assembly: MSBuild.ExtensionPack (in MSBuild.ExtensionPack.dll) Version: 4.0.0.0
The Email type exposes the following members.
Constructors
Name | Description | |
---|---|---|
Properties
Name | Description | |
---|---|---|
Attachments |
An Item Collection of full paths of files to attach to the email.
| |
Body |
The body of the email.
| |
EnableSsl |
Sets whether to EnableSsl
| |
Format |
Sets the format of the email. Default is HTML
| |
MailFrom |
The email address to send the email from.
| |
MailTo |
Sets the Item Colleciton of email address to send the email to.
| |
Port |
Sets the port to use. Ignored if not specified.
| |
Priority |
The priority of the email. Default is Normal (also available High and Low).
| |
SmtpServer |
The SMTP server to use to send the email.
| |
Subject |
The subject of the email.
| |
UseDefaultCredentials |
Gets or sets a Boolean value that controls whether the DefaultCredentials are sent with requests. DefaultCredentials represents the system credentials for the current security context in which the application is running. Default is true.
If UserName and UserPassword is supplied, this is set to false. If UserName and UserPassword are not supplied and this is set to false then mail is sent to the server anonymously. If you provide credentials for basic authentication, they are sent to the server in clear text. This can present a security issue because your credentials can be seen, and then used by others. |
Examples
<Project ToolsVersion="4.0" DefaultTargets="Default" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <PropertyGroup> <TPath>$(MSBuildProjectDirectory)\..\MSBuild.ExtensionPack.tasks</TPath> <TPath Condition="Exists('$(MSBuildProjectDirectory)\..\..\Common\MSBuild.ExtensionPack.tasks')">$(MSBuildProjectDirectory)\..\..\Common\MSBuild.ExtensionPack.tasks</TPath> </PropertyGroup> <Import Project="$(TPath)"/> <Target Name="Default"> <ItemGroup> <!-- Specify some attachments --> <Attachment Include="C:\demo.txt"/> <Attachment Include="C:\demo2.txt"/> <!-- Specify some recipients --> <Recipient Include="[email protected]"/> <Recipient Include="[email protected]"/> </ItemGroup> <MSBuild.ExtensionPack.Communication.Email TaskAction="Send" Subject="Test Email" SmtpServer="yoursmtpserver" MailFrom="[email protected]" MailTo="@(Recipient)" Body="body text" Attachments="@(Attachment)"/> </Target> </Project>
See Also