I have code for sending email to clients.
System.Net.Mail.SmtpClient Client = new System.Net.Mail.SmtpClient();
MailMessage Message = new MailMessage("From", "To", "Subject", "Body");
Client.Send(Message);
With following in App.config.
<system.net>
<mailSettings>
<smtp from="support@MyDomain1.com">
<network host="smtp.MyDomain1.com" port="111" userName="abc" password="helloPassword1" />
</smtp>
</mailSettings>
<mailSettings>
<smtp from="support@MyDomain2.com">
<network host="smtp.MyDomain2.com" port="222" userName="xyz" password="helloPassword2" />
</smtp>
</mailSettings>
</system.net>
Problem is that in my code how can I differentiate which mailsetting to use for a given mail, meaning when I want to send mail from MyDomain1 account vs MyDomain2 account