Send emails in C#
Today I’ll show you how to send easily emails in C#. All that is required, comes with the System.Net.Mail namespace.
In order to be able to send email using the subsequent snippets, all you need is the address of a SMTP server and some login data for even those. (Open, i.e. anonymous STMP servers, aren’t eas to find these days.)
To obtain the address of your provider’s SMTP server you should look on the websites of your provider or glance at one of the following three lists ([1] [2] [3]).
If you have found out the server address and your credentials, we can begin.
public void sendMail(string sender, string recipient,
string subject, string message,
[…]