protected void Page_Load(object sender, EventArgs e) { _logging = IoC.IoC.Get<ILog>(); _date = IoC.IoC.Get<IDate>(); _settings = IoC.IoC.Get<ISettings>(); _emailNotificationItems = IoC.IoC.Get<IEmailNotificationItems>(); _sendEmail = IoC.IoC.Get<IEmail>(); _status = IoC.IoC.Get<IStatus>(); var url = Request.Url.AbsoluteUri; if (Request.QueryString["csvfile"] == null) { numberOfRun += 1; _logging.Msg("CroneJob startet, " + numberOfRun); if (DateTime.Now.Hour == 8) { _sendEmail.SendEmail("*****@*****.**", "*****@*****.**", "Cronejob startet kl. 8:00, antal gange det er kørt siden sidst: " + numberOfRun, ""); numberOfRun = 0; } url = null; } Run(url); }
/// <summary> /// /// </summary> /// <param name="email"></param> /// <exception cref="ArgumentException">On failure to parse some aspect of the email</exception> public void HandleEmail(IEmail email) { if (IsGoogleVoiceEmail(email.Header.From)) { ServiceLocator.Current.Log.Information("IsGoogleVoiceEmail == true"); // Extract the message Message message = GvEmailParser.ParseMessage(email); // Send it to all of the recipient's push endpoints SendMessage(message); } else if (IsEmailForwardPermissionMail(email.Header.From, email.Header.Subject)) { ServiceLocator.Current.Log.Information("IsEmailForwardPermissionMail == true"); string link = GvEmailParser.ParsePermission(email); string userEmail = GvEmailParser.ParsePermissionForUserEmail(email); bool clicked = ServiceLocator.Current.LinkClicker.Click(link); if (clicked && userEmail != null) { ServiceLocator.Current.Log.Information("Email forward request successful."); // Notify the user of success Message message = new Message() { Body = "Forwarding setup successfully!", Number = "avoice", Sender = "aVoice Push", ThreadId = null, Type = null, UserEmail = userEmail }; SendMessage(message); } else if (userEmail != null) { ServiceLocator.Current.Log.Error("Failed to accept forward request. link: {0}. userEmail: {1}. clicked: {2}", link, userEmail, clicked ? "true" : "false"); // Ugh, we failed Message message = new Message() { Body = "Confirmation code: " + GvEmailParser.ParsePermissionForCode(email), Number = "avoice", Sender = "aVoice Push", ThreadId = null, Type = null, UserEmail = userEmail }; SendMessage(message); } } else { ServiceLocator.Current.Log.Warning("We've received an email that we don't have logic to handle. From: " + email.Header.From); } }
public void Init(IInviteFriends view) { _view = view; _userSession = ObjectFactory.GetInstance<IUserSession>(); _email = ObjectFactory.GetInstance<IEmail>(); _webContext = ObjectFactory.GetInstance<IWebContext>(); _account = _userSession.CurrentUser; if (_account != null) { _view.DisplayToData(_account.FirstName + " " + _account.LastName + " <" + _account.Email + ">"); if (_webContext.AccoundIdToInvite > 0) { _accountToInvite = Account.GetAccountByID(_webContext.AccoundIdToInvite); if (_accountToInvite != null) { SendInvitation(_accountToInvite.Email, _accountToInvite.FirstName + " " + _accountToInvite.LastName + " muốn kết bạn với bạn!"); _view.ShowMessage(" Yêu cầu kết bạn đã được gửi đến" + _accountToInvite.Username); _view.TogglePnlInvite(false); } } } }
public void Init(IInviteFriends view) { _view = view; //_userSession = ObjectFactory.GetInstance<IUserSession>(); //_email = ObjectFactory.GetInstance<IEmail>(); //_friendInvitationRepository = ObjectFactory.GetInstance<IFriendInvitationRepository>(); //_accountRepository = ObjectFactory.GetInstance<IAccountRepository>(); //_webContext = ObjectFactory.GetInstance<IWebContext>(); _userSession = new SPKTCore.Core.Impl.UserSession(); _friendInvitationRepository = new SPKTCore.Core.DataAccess.Impl.FriendInvitationRepository(); _email = new SPKTCore.Core.Impl.Email(); _webContext = new SPKTCore.Core.Impl.WebContext(); if (_userSession.LoggedIn) { _account = _userSession.CurrentUser; _accountRepository = new SPKTCore.Core.DataAccess.Impl.AccountRepository(); if (_account != null) { _view.DisplayToData(_account.UserName + " <" + _account.Email + ">"); if (_webContext.AccoundIdToInvite > 0) { _accountToInvite = _accountRepository.GetAccountByID(_webContext.AccoundIdToInvite); if (_accountToInvite != null) { SendInvitation(_accountToInvite.Email, _account.UserName + " " + _account.UserName + " "); _view.ShowMessage(_accountToInvite.UserName + " Đã được gửi đi!"); _view.TogglePnlInvite(false); } } } } }
public RecoverPasswordPresenter() { // _email = ObjectFactory.GetInstance<IEmail>(); // _accountRepository = ObjectFactory.GetInstance<IAccountRepository>(); _email = new SPKTCore.Core.Impl.Email(); _accountRepository = new SPKTCore.Core.DataAccess.Impl.AccountRepository(); }
public EditAccountPresenter() { _userSession = ObjectFactory.GetInstance<IUserSession>(); _accountRepository = ObjectFactory.GetInstance<IAccountRepository>(); _redirector = ObjectFactory.GetInstance<IRedirector>(); _accountService = ObjectFactory.GetInstance<IAccountService>(); _email = ObjectFactory.GetInstance<IEmail>(); }
public AdminController(IAccountPermissionDAL accountPermissionDAL, IAccountDAL accountDAL, IPermissionDAL permissionDAL, IProfileDAL profileDAL, IEmail _email) { this.accountPermissionDAL = accountPermissionDAL; this.accountDAL = accountDAL; this.permissionDAL = permissionDAL; this.profileDAL = profileDAL; this._email = _email; }
public AccountController(FacebookDataContext _myDbContext, IUserData _userData, IConfiguration _Configuration, IEmail _email, IJwt _jwt) { db = _myDbContext; userData = _userData; Configuration = _Configuration; email = _email; jwt = _jwt; }
public RegisterPresenter() { _accountService = new AccountService(); _webContext = new WebContext(); _email = new Email(); _redirector = new Redirector(); _parameterIntService = new ParameterIntService(); }
public EditAccountPresenter() { _userSession = new UserSession(); _accountRepository = new SPKTCore.Core.DataAccess.Impl.AccountRepository(); _redirector = new Redirector(); _accountService = new AccountService(); _email = new Email(); }
public void Update(IEmail email) { SettingEntity = (EmailSettingEntity)email.Setting; SegmentEntity = (SegmentEntity)email.Segment; Name = email.Name; HTML = email.HTML; Cron = email.Cron; }
public EmailTemplateEngine(IEmail emailTemplate, string htmlTemplateSuffix, string textTemplateSuffix, string sharedTemplateSuffix) { Invariant.IsNotNull(emailTemplate, "emailTemplate"); _subject = emailTemplate.Subject; _body = emailTemplate.Body; SharedTemplateSuffix = sharedTemplateSuffix; HtmlTemplateSuffix = htmlTemplateSuffix; TextTemplateSuffix = textTemplateSuffix; }
public async Task <SendResponse> SendAsync(IEmail email, CancellationToken?token = null) { var response = new SendResponse(); await SaveEmailToDisk(email); return(response); }
public DeepLinkingService(IMainThread mainThread, IBrowser browser, IEmail email, IAppInfo appInfo, ILauncher launcher) { _appInfo = appInfo; _email = email; _browser = browser; _mainThread = mainThread; _launcher = launcher; }
protected void Page_Load(object sender, EventArgs e) { _email = new SPKTCore.Core.Impl.Email(); _usersession = new SPKTCore.Core.Impl.UserSession(); _webcontext = new WebContext(); _ac = new AccountRepository(); bt_invite.Text = "Gửi lời mời bạn"; }
public StudentsController(IStudentsServices studentServices, IEmail email, IEncryption encryption, IHoursServices hoursServices, IMajorsServices majorServices) { _studentsServices = studentServices; _email = email; _encryption = encryption; _hoursServices = hoursServices; _majorServices = majorServices; }
public MessageService() { _userSession = new SPKTCore.Core.Impl.UserSession(); _messageRepository = new SPKTCore.Core.DataAccess.Impl.MessageRepository(); _messageRecipientRepository = new SPKTCore.Core.DataAccess.Impl.MessageRecipientRepository(); _accountRepository = new SPKTCore.Core.DataAccess.Impl.AccountRepository(); _email =new SPKTCore.Core.Impl.Email(); }
public AccountService() { _accountRepository = ObjectFactory.GetInstance<IAccountRepository>(); _permissionRepository = ObjectFactory.GetInstance<IPermissionRepository>(); _userSession = ObjectFactory.GetInstance<IUserSession>(); _redirector = ObjectFactory.GetInstance<IRedirector>(); _email = ObjectFactory.GetInstance<IEmail>(); }
public BandController(IWillProvideBands bands, ISummariseBands bandSummary, IGiveYouGigs gigs, IEmail email, ISayThanks thanks) { this.bands = bands; this.thanks = thanks; this.email = email; this.gigs = gigs; this.bandSummary = bandSummary; }
public AccountController(IAccountDAL accountDAL, IEmail _email, IUserSession userSession, ISessionWrapper sessionWrapper, IAccountPermissionDAL accountPermissionDAL, IProfileDAL profileDAL) { this.accountDAL = accountDAL; this._email = _email; this.userSession = userSession; this.sessionWrapper = sessionWrapper; this.accountPermissionDAL = accountPermissionDAL; this.profileDAL = profileDAL; }
/// <summary> /// Sends an email type that has defined/configured recipients /// </summary> /// <param name="email">The implementation of the IEmail interface</param> /// <param name="type">The type of email being sent</param> /// <param name="cc">Who gets copied on the email</param> /// <param name="subject">Subject of the email</param> /// <param name="content">Email body</param> /// <returns>True if send seems to be successful, false otherwise</returns> public static Task <bool> SendAsync( IEmail email, EmailType type, string cc, string subject, string content) => SendAsync(email, type, null, new List <string> { cc }, subject, content);
public EditAccountPresenter() { _userSession = new UserSession(); _accountRepository = new SPKTCore.Core.DataAccess.Impl.AccountRepository(); _redirector = new Redirector(); _accountService = new AccountService(); _permissionRepository = new PermissionRepository(); _email = new Email(); }
/// <summary> /// Sends a custom email /// </summary> /// <param name="email">The implementation of the IEmail interface</param> /// <param name="to">A collection of "to" recipients of the email</param> /// <param name="cc">Who gets copied on the email</param> /// <param name="subject">Subject of the email</param> /// <param name="content">Email body</param> /// <returns>True if send seems to be successful, false otherwise</returns> public static Task <bool> SendAsync( IEmail email, IEnumerable <string> to, string cc, string subject, string content) => SendAsync(email, EmailType.Custom, to, new List <string> { cc }, subject, content);
public EmailExistCommandValidator(IApplicationDbContext context, IEmail email) { _context = context; _email = email; RuleFor(v => v.Email) .NotEmpty().WithMessage("Email cannot be empty.") .MustAsync(BeUniqueEmail).WithMessage("Email already taken."); }
public BuyOrderServices(SocialNetworkDeveloperContext context, IMapper mapper, IEmail email, IUser user, IPublication publication, ITwilio twilioServices) { _context = context; _mapper = mapper; _emailServices = email; _userServices = user; _publicationServices = publication; _twilioServices = twilioServices; }
protected void Page_Load(object sender, EventArgs e) { _email = new SPKTCore.Core.Impl.Email(); _usersession = new SPKTCore.Core.Impl.UserSession(); _webcontext = new WebContext(); _ac = new AccountRepository(); _redirect = new Redirector(); bt_invite.Text = "Mời bạn"; }
public EmailEntity(IEmail email) { Id = Guid.NewGuid(); SettingEntity = (EmailSettingEntity)email.Setting; SegmentEntity = (SegmentEntity)email.Segment; Name = email.Name; HTML = email.HTML; Cron = email.Cron; }
public IndexModel( UserManager <IdentityUser> userManager, SignInManager <IdentityUser> signInManager, IEmail emailSender) { _userManager = userManager; _signInManager = signInManager; _emailSender = emailSender; }
/// <summary> /// 构造器 指定DLL文件和全类名 /// </summary> /// <param name="dllFileName">dll文件名</param> /// <param name="className">命名空间.类名</param> public Email(string dllFileName, string className) { errorMessage = string.Empty; if (email.IsNull()) { email = (IEmail)dllFileName.LoadClass(className); smtpClient = new SmtpClient(); message = new MailMessage(); linkeds = new List<LinkedResource>(); } }
/// <summary> /// 构造器 指定classNameDllName(EmailProviderName) 默认Pub.Class.SmtpClient.SendEmail,Pub.Class.SmtpClient /// </summary> /// <param name="classNameAndAssembly">命名空间.类名,程序集名称</param> public Email(string classNameAndAssembly) { errorMessage = string.Empty; if (email.IsNull()) { email = (IEmail)classNameAndAssembly.IfNullOrEmpty("Pub.Class.Email.SmtpClient.SendEmail,Pub.Class.Email.SmtpClient").LoadClass(); smtpClient = new SmtpClient(); message = new MailMessage(); linkeds = new List<LinkedResource>(); } }
public AccountService() { _userSession = ObjectFactory.GetInstance<IUserSession>(); _email = ObjectFactory.GetInstance<IEmail>(); _redirector = ObjectFactory.GetInstance<IRedirector>(); _profileService = ObjectFactory.GetInstance<IProfileService>(); _friendService = ObjectFactory.GetInstance<IFriendService>(); _webContext = ObjectFactory.GetInstance<IWebContext>(); }
/// <summary> /// 构造器 从Web.config中读EmailProviderName 默认Pub.Class.SmtpClient.SendEmail,Pub.Class.SmtpClient /// </summary> public Email() { errorMessage = string.Empty; if (email.IsNull()) { email = (IEmail)(WebConfig.GetApp("EmailProviderName") ?? "Pub.Class.Email.SmtpClient.SendEmail,Pub.Class.Email.SmtpClient").LoadClass(); smtpClient = new SmtpClient(); message = new MailMessage(); linkeds = new List<LinkedResource>(); } }
public T CreateEmail <T>(IEmail source) where T : IEmail, new() { var target = CreateAddressInfo <T>(source); target.EmailAddress = source.EmailAddress; return(target); }
public void SendEmail(IEmailConstructor constructor, string Subject, string Message) { //_emailConstructor = new EmailConstructor(); IEmail email = constructor.CreateEmail(); email.Message = Message; email.Subject = Subject; Send(email); }
public CreateEmployeeCommandHandler(IApplicationDbContext context, ICurrentUserService currentUserService, IIdentityService userManager, ICloudinary cloudinaryService, IEmail email) { _context = context; _currentUserService = currentUserService; _userManager = userManager; _cloudinaryService = cloudinaryService; _email = email; }
public NoteController(INoteDAL noteDAL, IAccountDAL accountDAL, IProfileDAL profileDAL, IEmail _email, ISessionWrapper sessionWrapper, IUserSession userSession) { this.accountDAL = accountDAL; this.profileDAL = profileDAL; this._email = _email; this.sessionWrapper = sessionWrapper; this.userSession = userSession; this.noteDAL = noteDAL; }
public override void Execute(IJobExecutionContext context) { // Grab a list of users who have not signed up after their trial expiry for more than 5 days List <IUser> lostUsers = (from user in _database.GetUsers where user.TrialExpiryDate < DateTime.UtcNow && !user.SubscriptionId.HasValue && !user.SubscriptionExpiryDate.HasValue && !user.SentFeedbackRequest && EntityFunctions.DiffDays(user.TrialExpiryDate, DateTime.UtcNow) > 5 select user).ToList(); // Generate email body content // TODO EmailResult emailContents = _accountEmailFactory.LostUserFeedback(); // Create email and send IEmail feedbackEmail = _emailFactory.CreateEmail( contents: this.GetEmailContents(), subject: "Feedback Request", sender: new EmailSender() { Name = "Stockwinners.com", EmailAddress = "*****@*****.**" }, // Send from [email protected] so that the user can reply back recipients: lostUsers); feedbackEmail.Send(); // Mark that email has been sent to users foreach (var user in lostUsers) { user.SentFeedbackRequest = true; } _database.SaveChanges(); // Notify admins StringBuilder adminEmailContents = new StringBuilder(); adminEmailContents.Append("<html><head></head><body>Fellow admins, I just emailed "); adminEmailContents.Append(lostUsers.Count); adminEmailContents.Append(" users and asked them for feedback. These folks have chosen not to sign up after 5 days after their trial expiry date. Here is the list:<br/><br>"); foreach (var user in lostUsers) { adminEmailContents.Append(user.FirstName); adminEmailContents.Append(" "); adminEmailContents.Append(user.LastName); adminEmailContents.Append(" "); adminEmailContents.Append(user.EmailAddress); adminEmailContents.Append("<br/>"); } adminEmailContents.Append("<br/>Adios!</body></html>"); IEmail adminNotification = _emailFactory.CreateEmailForAdministrators(adminEmailContents.ToString(), "Feedback Request " + DateTime.UtcNow.ToShortDateString()); adminNotification.Send(); }
public CotCotadoComService() { repository = new EFRepository <CotCotadoCom>(); serviceEmail = new EnviarEmail(); serviceCotFornecedor = new CotFornecedorService(); serviceParamentro = new SistemaParametroService(); serviceRequisicao = new ReqRequisicaoService(); serviceCotCotacao = new CotCotacaoService(); serviceCotDadosCotacao = new CotDadosCotacaoService(); }
public CheckoutModel(IPaymentHandler payment, ICart cart, UserManager <ApplicationUser> userManager, IOrder order, IOrderItem orderItem, ICartItem cartItem, IEmail email) { _payment = payment; _cart = cart; _cartItem = cartItem; _userManager = userManager; _order = order; _orderItem = orderItem; _email = email; }
public EmployersController(UserManager <User> userManager, RoleManager <IdentityRole> roleManager, IOptions <EmailOptionsDTO> emailOptions, IEmail email, ICloudStorage cloudStorage, IMapper mapper) { _mapper = mapper; _email = email; _cloudStorage = cloudStorage; _emailOptions = emailOptions; _roleManager = roleManager; _userManager = userManager; }
protected void Page_Load(object sender, EventArgs e) { _usersession = new SPKTCore.Core.Impl.UserSession(); _fi = new SPKTCore.Core.DataAccess.Impl.FriendInvitationRepository(); _f = new SPKTCore.Core.DataAccess.Impl.FriendRepository(); _email = new SPKTCore.Core.Impl.Email(); _presenter = new ProfileDisplayPresenter(); _ac = new AccountRepository(); _presenter.Init(this); }
public ReqComprarService() { this.servicePedido = new PedidoService(); this.serviceParcela = new ParcelaService(); this.serviceRequisicao = new ReqRequisicaoService(); this.serviceRequisicaoLogistica = new ReqRequisicaoService(); this.serviceCotCom = new CotCotacaoService(); serviceEmail = new EnviarEmail(); config = new SistemaConfigService(); }
public MainFormViewModel(string userName, string password, string excelDownloadFilePath, IEmail email, ISVN svn, IStatusGenerator dailyStatus) { _userName = userName; _password = password; _email = email; _svn = svn; _dailyStatus = dailyStatus; _excelDownloadFilePath = excelDownloadFilePath; observers = new List <IObserver <MainFormViewModel> >(); }
public ReportsViewModel() { Continue = new Command(() => { email = ServicesManager.Instance.Email; createPDF(); BaseContentPage.Instance.PopModal(); }); }
public HomeController(IForum forumService, IPost postService, UserManager <ApplicationUser> userManager, IEmail emailService, IForm formService) { _forumService = forumService; _postService = postService; _userManager = userManager; _emailService = emailService; _formService = formService; }
public LoginsController(ILogins loginService, IHttpContextAccessor httpContextAccessor, UserManager <IdentityUser> userManager, SignInManager <IdentityUser> signInManager, RoleManager <IdentityRole> roleManager, IEmail email) { _loginService = loginService; _httpContextAccessor = httpContextAccessor; _userManager = userManager; _signInManager = signInManager; _roleManager = roleManager; _email = email; }
public static bool TryParse(string value, out IEmail email) { if (Assertion.IsEmail(value)) { email = new Email(value); return true; } email = null; return false; }
public EmailNotification(ILog logging, IDate date, ISettings settings, IEmailNotificationItems emailNotificationItems, IEmail sendEmail, IStatus status, String emailFrom, String url) { _settings = settings; _emailNotificationItems = emailNotificationItems; _sendEmail = sendEmail; _status = status; _date = date; _log = logging; _emailFrom = emailFrom; _url = url; }
public AccountService() { _accountRepository = new SPKTCore.Core.DataAccess.Impl.AccountRepository(); _permissionRepository = new SPKTCore.Core.DataAccess.Impl.PermissionRepository(); _userSession = new UserSession(); _redirector = new Redirector(); _email = new Email(); _profileService = new ProfileService(); _webContext=new SPKTCore.Core.Impl.WebContext(); _friendService = new SPKTCore.Core.Impl.FriendService(); //friendInvitation = new FriendInvitation(); }
public RegisterPresenter() { _accountService = new AccountService(); _webContext = new WebContext(); _email = new Email(); _redirector = new Redirector(); _parameterIntService = new ParameterIntService(); _friendInvitationRepository = new SPKTCore.Core.DataAccess.Impl.FriendInvitationRepository(); _friendService = new SPKTCore.Core.Impl.FriendService(); _accountRepository = new SPKTCore.Core.DataAccess.Impl.AccountRepository(); friendInvitation = new FriendInvitation(); }
public void Send(IEmail email) { SmtpClient client = new SmtpClient(); //takes settings from config MailAddress from = new MailAddress(email.EmailAddressFrom); MailAddress to = new MailAddress(email.EmailAddressTo); MailMessage message = new MailMessage(from, to); message.IsBodyHtml = true; message.Subject = email.Subject; message.Body = email.Body; client.Send(message); }
public void Init(IRegister view) { _view = view; _accountRepository = ObjectFactory.GetInstance<IAccountRepository>(); _permissionRepository = ObjectFactory.GetInstance<IPermissionRepository>(); _termRepository = ObjectFactory.GetInstance<ITermRepository>(); _accountService = ObjectFactory.GetInstance<IAccountService>(); _webContext = ObjectFactory.GetInstance<IWebContext>(); _email = ObjectFactory.GetInstance<IEmail>(); _configuration = ObjectFactory.GetInstance<IConfiguration>(); _view.LoadTerms(_termRepository.GetCurrentTerm()); }
public EditAccountPresenter() { /* _userSession = ObjectFactory.GetInstance<IUserSession>(); _accountRepository = ObjectFactory.GetInstance<IAccountRepository>(); _redirector = ObjectFactory.GetInstance<IRedirector>(); _accountService = ObjectFactory.GetInstance<IAccountService>(); _email = ObjectFactory.GetInstance<IEmail>();*/ _userSession = new UserSession(); _accountRepository = new SPKTCore.Core.DataAccess.Impl.AccountRepository(); _redirector = new Redirector(); _accountService = new AccountService(); _email = new Email(); }
public AvatarConfiguration(IEmail email, IAvatarFolder folder, int width = 100, AvatarImageExtension extension = AvatarImageExtension.Jpg, AvatarRating rating = AvatarRating.G, AvatarDefaultImage defaultimage = AvatarDefaultImage.NoImage) { Email = email; Folder = folder; ValidateRange(width); Width = width; FileName = Email.Hash; Extension = extension; Rating = rating; DefaultImage = defaultimage; }
public void Send(IEmail email) { var smtp = new SmtpClient(); smtp.EnableSsl = true; smtp.DeliveryMethod = SmtpDeliveryMethod.Network; MailMessage message = new MailMessage(new MailAddress(email.FromEmailAddress, "Williamson Family Website"), new MailAddress(email.ToEmailAddress)) { Subject = email.Subject, Body = email.Body, IsBodyHtml = true }; smtp.Send(message); }
public AccountService() { //TODO: CẤP THIẾT hic hic //_accountRepository = ObjectFactory.GetInstance<IAccountRepository>(); //_permissionRepository = ObjectFactory.GetInstance<IPermissionRepository>(); //_userSession = ObjectFactory.GetInstance<IUserSession>(); //_redirector = ObjectFactory.GetInstance<IRedirector>(); //_email = ObjectFactory.GetInstance<IEmail>(); _accountRepository = new SPKTCore.Core.DataAccess.Impl.AccountRepository(); _permissionRepository = new SPKTCore.Core.DataAccess.Impl.PermissionRepository(); _userSession = new UserSession(); _redirector = new Redirector(); _email = new Email(); _profileService = new ProfileService(); }
public static void SendMail(IEmail msg) { var mail = new MailMessage(); mail.From = new MailAddress(msg.From); mail.To.Add(new MailAddress(msg.To)); if (!string.IsNullOrWhiteSpace(msg.Cc)) mail.CC.Add(new MailAddress(msg.Cc)); mail.Subject = msg.Subject; mail.Body = msg.Body; mail.IsBodyHtml = msg.IsBodyHtml; SmtpClient smtp = new SmtpClient("smtpmail"); smtp.Send(mail); }
public static MailMessage MapTo(IEmail email) { MailMessage mail = new MailMessage { Subject = email.Subject, Body = email.Body, BodyEncoding = Encoding.UTF8, IsBodyHtml = email.IsBodyHtml }; foreach (var receiver in email.Receivers) { mail.To.Add(new MailAddress(receiver)); } foreach (var cc in email.CC) { mail.To.Add(new MailAddress(cc)); } foreach (var attachment in email.Attachments) { mail.Attachments.Add(new Attachment(attachment)); } foreach (var reply in email.ReplyToList) { mail.ReplyToList.Add(new MailAddress(reply)); } return mail; }