Sending a basic email message in a C# application is quite easy thanks to a class called SmptClient. We simply need an address to send to, an address to send from, the message we want to send and the address of an SMTP server, hand it all to the SMTP client, and you’re done:
var to = new MailAddress("you@example.com", "You");
var message = new MailMessage(from, to)
{
Subject = "Greetings!",
Body = "How are you doing today?",
};
var client = new SmtpClient("smtp.example.com");
using (client)
{
try
{
client.Send(message);
}
catch (SmtpException e)
{
Console.WriteLine(e.Message);
}
}
That was pretty simple, wasn’t it? But what if we need to authenticate with our server? And what if we want to send our message in a more secure manner?
Anyways, in Visual Studio you will now probably have a blue (is blue here at least) squiggly line under the
, where
and
.
, is the first term to contain three digits.
and the sum of its digits is
.
?
Have you gone through three years of computer science bachelor degree fun (or anything similar) and pretty much not heard a word about testing? Or have you heard from all your teachers that testing is extremely important, but never learned how to even write one? That has been the case for me. Testing is important, you all got to do it, it is very important, always test, do it a lot! Well, sure… but how do I do it? How do I write one of these tests?