public void Produce(string address, string url) { using (var client = new SmtpClient()) { var emailSettings = _configurationSectionProvider.GetSection(); client.Connect( host: emailSettings.SmtpHost, port: emailSettings.SmtpPort, options: emailSettings.EnableSsl ? SecureSocketOptions.StartTlsWhenAvailable : SecureSocketOptions.None); client.Authenticate(emailSettings.UserName, emailSettings.Password); var message = new MimeMessage(); message.From.Add(new MailboxAddress("Some Application", emailSettings.SenderAddress)); message.To.Add(new MailboxAddress("Someone", address)); message.Subject = "Confirmation"; var bodyBuilder = new BodyBuilder { HtmlBody = string.Format(Resources.Confirmation, url) }; message.Body = bodyBuilder.ToMessageBody(); client.Send(message); client.Disconnect(true); } }
public static IConfigurationSectionContents Create(IConfigurationSectionProvider provider, string sectionName) { var lines = provider.GetSection(sectionName, FilterDirectories); return(lines); }
/// <summary> /// Sets the general configuration properties to values read from configuration file. Only value which can be set /// through <see cref="T:Sportradar.OddsFeed.SDK.API.IConfigurationBuilderBase`1" /> methods are set. Any values already set by methods on the current instance are overridden /// </summary> /// <returns>T.</returns> public T LoadFromConfigFile() { LoadFromConfigFile(SectionProvider.GetSection()); return(this as T); }
/// <summary> /// Initializes a new instance of the <see cref="OddsFeedConfigurationBuilder"/> class /// </summary> /// <param name="sectionProvider">A <see cref="IConfigurationSectionProvider"/> used to retrieve settings from config file</param> public OddsFeedConfigurationBuilder(IConfigurationSectionProvider sectionProvider) { _section = sectionProvider?.GetSection(); Init(); }
/// <summary> /// Sets the access token used to access feed resources (AMQP broker, Sports API, ...) to value read from configuration file /// </summary> /// <returns>The <see cref="IEnvironmentSelector" /> instance allowing the selection of target environment</returns> public IEnvironmentSelector SetAccessTokenFromConfigFile() { return(new EnvironmentSelector(_configurationSectionProvider.GetSection().AccessToken, _configurationSectionProvider)); }
public static IConfigurationSectionContents Create(IConfigurationSectionProvider provider, string sectionName) { var lines = provider.GetSection(sectionName, FilterDirectories); return lines; }
private List <PathMatcher> CreateMatcherLines() { var patterns = _configurationSectionProvider.GetSection(_configurationFileName, FilterDirectories); return(patterns.Select(x => PatternParser.ParsePattern(x)).ToList()); }