Reputation: 2973
How do I send mail to a specific user group (using Active Directory
)?
As for now I have defined an interface like this:
public interface IMailingService {
void SendMessage(String from, String to, String subject, String body);
}
with implementation like this:
public class MailingService : IMailingService {
public void SendMessage(String from, String to, String subject, String body) {
using(var client = new SmtpClient()) {
client.SendAsync(
from: from,
recipients: to,
subject: subject,
body: body,
userToken: "hahaha!"
);
}
}
}
I'm using an smtp client in conjunction with the following configuration.
<system.net>
<mailSettings>
<smtp deliveryMethod="Network" from="[email protected]">
<network host="host" port="25" userName="username" password="password" />
</smtp>
</mailSettings>
</system.net>
But it is hard for me to understand which service should present the behavior, user service which handles ldap-connections
or a separate service (following the SOC
principle)?
Any examples?
Thanks!
Upvotes: 1
Views: 163
Reputation: 2989
Sending an email to a user group should work the same way as sending to an individual user.
User groups usually have their own email address and then the Active Directory will handle the rest.
Unless I am misunderstanding your question here.
Upvotes: 1