title: How do I store emails into my SQL server database?
body: <p>I am trying to store emails into my SQL server database. These emails I got from Exchange Webservices.</p>
  
  <p>I am using entity Framework and made a ADO .Net Data Model.</p>
  
  <p>My Question is how do I make a method(StoreEmail) that stores these emails into my database.</p>
  
  <p>This is my StoreEmail method that I got so far:</p>
  
  <p>It should store my PhishingMails...</p>
  
  <pre><code>          public object StoreMail(Model.PhishingMail PhishingMail)
           {
             using (var phishingMailStorage = new PhishFinderModel())
          {
              PhishingMail = MailMapper.Map(Model.PhishingMail);
              phishingMailStorage.PhishingMails.Add();
  
              phishingMailStorage.SaveChanges();
  
              return PhishingMail;
          }
  
      }
  </code></pre>
  
  <p>In Mailmapper class I set the properties that I want to store, which are Sender, Subject and Body:</p>
  
  <pre><code>      public static PhishingMail Map(EmailMessage OutlookMail)
      {
  
  
          PhishingMail readMail = new PhishingMail();
  
          readMail.Sender = OutlookMail.Sender.Address;
          readMail.Body = OutlookMail.Body;
  
           return readMail;
  
    }
  </code></pre>
  
  <p>This is my DB schema<a href="https://i.stack.imgur.com/X2Kmi.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/X2Kmi.jpg" alt="enter image description here"></a></p>
  
  <p>To clarify my question, I already get the list of emails from the exchange server. Now, all I need to do is insert them into the SQL server.</p>
  
  <p>How do I make my StoreEmail method work to do this?</p>
  
  <p>Please don't be harsh I am really new to this. It feels like I am swimming in an ocean of information and I don't know where to look or start. So any suggested tutorials are very welcome.</p>
  
  <p>Thanks!</p>