Castle.MonoRail.Framework.Services.MonoRailSmtpSender.Service C# (CSharp) Method

Service() public method

Services the specified provider.
public Service ( IServiceProvider provider ) : void
provider IServiceProvider The provider.
return void
		public void Service(IServiceProvider provider)
		{
			MonoRailConfiguration config = (MonoRailConfiguration) provider.GetService(typeof(MonoRailConfiguration));

			sender = new SmtpSender(config.SmtpConfig.Host);
			sender.Port = config.SmtpConfig.Port;

			if (config.SmtpConfig.Username != null && config.SmtpConfig.Username != String.Empty)
			{
				sender.UserName = config.SmtpConfig.Username;
			}
			if (config.SmtpConfig.Password != null && config.SmtpConfig.Password != String.Empty)
			{
				sender.Password = config.SmtpConfig.Password;
			}
		}