Specify LocalEndPoint/IP Address for where to send email from
Is there a way to specify the IP address of where to send emails from?
My host is moaning because the server I send from has multiple IP addresses and it triggers the Anti-Abuse system when sending large volumes of emails.
I am using MailKitSender and I believe this supports localendpoint configuration.
Made some changes in a local project to test but this is my suggested changes.
In SmtpClientOptions add an extra property .
public IPEndPoint LocalEndPoint { get; set; }
Then in the class MailKitSender, in both Send and SendAsync where you create the SmtpClient add this
if (_smtpClientOptions.LocalEndPoint != null) { client.LocalEndPoint = _smtpClientOptions.LocalEndPoint; }