United Kingdom +44 (0) 1424 863 450   hello@simego.com

Send an Email with Project Automation

How to send an email when a DS3 project is finished without using DS3 Server


13 June 2012

Step 1: Enable Project Automation on the project Automation Tab and past in the sample code

 

You simply implement the End method of the Automation Class and send an SMTP Email message like this.

 

    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@simego.com", "to@simego.com", "Synchronisation Result", message);                                                    
        }
    }

|
Can't find the answers you're looking for?