static void Main(string[] args) { var sender = new DefaultSmtpSender(); // Things that get reset from the auto-configuring SmtpClient: // - Port (587 in config, 25 wehn debugging) // - Credentials (user/pass in config, default creds when debugging) sender.Send("*****@*****.**", "*****@*****.**", "Subject", "Text"); }
public EmailService(string hostname, string sourceAddress, string contactAddress, bool testMode, ILogger logger, ISessionFactory sessionFactory) { defaultSmtpSender = new DefaultSmtpSender(hostname); this.sourceAddress = sourceAddress; this.contactAddress = contactAddress; this.testMode = testMode; this.logger = logger; this.session = sessionFactory.GetCurrentSession(); }