using System;
using System.Net.Mail;
using System.Configuration;
using System.Collections.Generic;
using System.Text;

namespace ExportFaktur
{
    public class EmailSender
    {
        public static void Send(string message)
        {
            try
            {
                MailMessage mailMessage = new MailMessage();
                mailMessage.From = new MailAddress(ConfigurationManager.AppSettings["Email.From"]);
                mailMessage.To.Add(ConfigurationManager.AppSettings["Email.To"]);
                mailMessage.Subject = ConfigurationManager.AppSettings["Email.Subject"] + " (" + DateTime.Now + ")";
                mailMessage.Body = message;
                SmtpClient smtpClient = new SmtpClient(ConfigurationManager.AppSettings["Email.Smtp"]);
                smtpClient.Send(mailMessage);
            }
            catch (Exception)
            {
                //TODO: Log exception
            }
        }
    }
}
