You can send email in Project Automation either manually with your own code or via the SendEmail helper method.
The Project Automation base class, provides a wrapper around the .NET SmtpClient class. This allows you to simply call this method to send email.
For example
public override void End(ProjectAutomationResult result)
{
if ( result.Success && result.HasChanges )
{
//Message to Send
string message = string.Format("New {0}, Updated {1}, Deleted {2}",
result.CompareResult.New.Count,
result.CompareResult.Updated.Count,
result.CompareResult.Deleted.Count);
//Send Message
SendEmail("to@domain.com", "Synchronisation Result", message);
}
}
You can specify the SMTP Server settings in-line or via Project Properties additionally if you have re-directed the ValuesService to Ouvvi these settings can come from Ouvvi system settings.
To send email via the .NET SmtpClient
class, simply implement your code in the End() method.
For example
public override void End(ProjectAutomationResult result)
{
if ( result.Success && result.HasChanges )
{
var smtpClient = new System.Net.Mail.SmtpClient("smtp.gmail.com", 587);
smtpClient.EnableSsl = true;
smtpClient.Credentials = new System.Net.NetworkCredential("username", "password");
//Message to Send
string message = string.Format("New {0}, Updated {1}, Deleted {2}",
result.CompareResult.New.Count,
result.CompareResult.Updated.Count,
result.CompareResult.Deleted.Count);
//Send Message
smtpClient.Send("from@domain.com", "to@domain.com", "Synchronisation Result", message);
}
}