I have a script in one of my workflows that sends an email using System.Net.Mail.SmtpClient.
I cannot use Workflow's default Email activity, because it doesn't allow changing some advanced options such as email and attachment headers.
My question: is the Workflow Server's email settings (the ones you configure in the WF Configuration Manager) exposed through the API? Otherwise I have to store credentials elsewhere (environment variables etc.) and I'd rather not do that because then we'd need to update a second thing if the server info changes.
Code snippet:
System.Net.Mail.SmtpClient smtpclient = new System.Net.Mail.SmtpClient(); smtpclient.Host = "mymailserver"; // Mail server hostname or IP smtpclient.Port = 25; smtpclient.Credentials = new System.Net.NetworkCredential("username@mailserver", "password"); // just an example, we don't hardcode credentials in scripts
I'd love to be able to replace these four lines with the SmtpClient workflow uses for its own Email activity.