So what you are asking is really how to connect to sql server using c# and access the data. I know nothing about your project/how you intend to access the data. There are many different ways to access sql server (normal ado.net, entity framework, nhibernate...etc.) so I'm going to assume you are using entity framework as that is the easiest way to answer this question.
What you need to do is first, research what it is you are trying to do as this is an extremely basic thing to do in C#. Accessing data, to me, is one step above Hello World and is something you should be familiar with already.
So to get the data you would do something like.
var mailToSend = context.Mail.Where(m=> !m.IsSent);
foreach(var mail in mailToSend)
{
SendEmail(mail.email, "You don't have a subject column, static text/passed in variable here", mail.memo);
}
the mailToSend variable is a collection of items from your database. You need to decide how you intend on accessing your data. For more information on using entity framework (and general C# to sql connections) see below links:
connect to sql server c - Google Search[
^]
use entity framework C# - Google Search[
^]
Getting Started (Entity Framework)[
^]
Getting Started with Entity Framework 6 Code First using MVC 5 | The ASP.NET Site[
^]
An Introduction to Entity Framework for Absolute Beginners[
^]
Entity Framework Tutorial[
^]
UPDATE:
In the off change you want to use Sql Server DB Mail...here are some links. You need to evaluate what it is you are trying to do and see which option best fits your needs.
sp_send_dbmail (Transact-SQL)[
^]
Configure Database Mail[
^]
SQL Database Mail – Send Emails from SQL Server – Microsoft SQL Server on Windows Azure Virtual Machines[
^]