Comments on: Read system.net/mailSettings/smtp settings from web.config https://www.limilabs.com/blog/read-system-net-mailsettings-smtp-settings-web-config Using Limilabs .net components Wed, 09 Apr 2014 13:28:20 +0000 hourly 1 https://wordpress.org/?v=6.6.2 By: Anthony https://www.limilabs.com/blog/read-system-net-mailsettings-smtp-settings-web-config#comment-596958 Fri, 21 Feb 2014 13:20:04 +0000 http://www.limilabs.com/blog/?p=4189#comment-596958 Tip for anyone using IIS/Pickup folder and working off the Mail.dll example above.

If you are enumerating through a list of recipients you will want to create a unique file name for each email you save otherwise your loop will just keep overwriting the previous file you created.

In c# you can use: Guid.NewGuid() to get a unique value.

In the case of the Mail.dll example above you would write:

string saveFile = Guid.NewGuid().ToString() + ".eml";
email.Save(Path.Combine(pickupFolder, saveFile));

Hope that helps somebody.

]]>
By: Limilabs support https://www.limilabs.com/blog/read-system-net-mailsettings-smtp-settings-web-config#comment-567245 Sun, 18 Aug 2013 21:00:53 +0000 http://www.limilabs.com/blog/?p=4189#comment-567245 In reply to Martin.

@Martin,

‘appSettings’ is a completely different section than ‘system.net’. ‘system.net’ section doesn’t support file attribute at all.

]]>
By: Martin https://www.limilabs.com/blog/read-system-net-mailsettings-smtp-settings-web-config#comment-567243 Sun, 18 Aug 2013 20:47:56 +0000 http://www.limilabs.com/blog/?p=4189#comment-567243 Being able to use system.net/mailSettings/smtp settings from web.config is definately useful and great to see.. its a shame that it couldn’t also successfully read from the section as I have a project where customized site settings are held in an extended appSettings file= “web-nichesettings.config” file to keep a clean separation of concerns.

Having Mail.dll being able to hook up to SMTP in this way would keep the white label code even cleaner.

]]>