Skip to content

Commit

Permalink
Add the ability to enable ssl for the MailTask.
Browse files Browse the repository at this point in the history
  • Loading branch information
rmboggs committed Dec 11, 2011
1 parent 311b65a commit 92efa1d
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions src/NAnt.Core/Tasks/MailTask.cs
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ public class MailTask : Task {
private string _userName = "";
private string _passWord = "";
private bool _isBodyHtml = false;
private bool _enableSsl = false;
private int _portNumber = 25;
private FileSet _files = new FileSet();
private FileSet _attachments = new FileSet();
Expand Down Expand Up @@ -148,6 +149,18 @@ public int Port
get { return _portNumber; }
set { _portNumber = value; }
}

/// <summary>
/// Indicates whether or not ssl should be used to
/// connect to the smtp host.
/// </summary>
[TaskAttribute("ssl")]
[BooleanValidator]
public bool EnableSsl
{
get { return _enableSsl; }
set { _enableSsl = value; }
}

/// <summary>
/// Text to send in body of email message.
Expand Down Expand Up @@ -366,6 +379,7 @@ protected override void ExecuteTask() {
smtp.UseDefaultCredentials = true;
}

smtp.EnableSsl = this.EnableSsl;
smtp.Port = this.Port;
smtp.Send(mailMessage);

Expand Down

0 comments on commit 92efa1d

Please sign in to comment.