简体   繁体   中英

How to get SMTPHost in custom workflow activity in MS Dynamics CRM?

I am trying to send email in custom workflow activity using SMTPClient instead of using Email entity and SendEmailRequest in MS Dynamics CRM custom workflow activity.

The reason I am doing this is because I want to send an calendar meeting invitation to the customer and not the email. For basics I got the code below:

MailMessage mail = new MailMessage("you@yourcompany.com", "user@hotmail.com");
SmtpClient client = new SmtpClient();
client.Port = 25;
client.DeliveryMethod = SmtpDeliveryMethod.Network;
client.UseDefaultCredentials = false;
client.Host = "smtp.google.com";
mail.Subject = "this is a test email.";
mail.Body = "this is my test email body";
client.Send(mail);

I intend to use DDay.iCal for the purpose.

Now this might seem to be a very basic question but I am stuck in how to get the Host name value in the custom workflow activity (instead of smtp.google.com).

Please advise.

Thanks,

I figured it out. It was in my email router configuration in "Email Server" column.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM