Is this the correct code for DiscountAsp Smtp in Web.config? <system.net> <mailSettings> <smtp from="[email protected]"> <network host="smtp.mydomainname.net" password="discountasploginpassword" userName="discountasploginusername"/> </smtp> </mailSettings> </system.net> I get the smpt into the class like so: Configuration config = System.Web.Configuration.WebConfigurationManager.OpenWebConfiguration(HttpContext.Current.Request.ApplicationPath); System.Net.Configuration.MailSettingsSectionGroup settings = (System.Net.Configuration.MailSettingsSectionGroup)config.GetSectionGroup("system.net/mailSettings"); Smtp = settings.Smtp.Network.Host.ToString();
..Like this with "localhost", without the actual host address: <system.net> <mailSettings> <smtp from="[email protected]" deliveryMethod="Network"> <network host="localhost" port="25" password="password" userName="[email protected]" /> </smtp> </mailSettings> </system.net>
1. The 'username' is my actual email address from my account settings? 2. The 'password' is my discountasp login password?
There is no authentication required for localhost. When sending emails from a web application using localhost smtp server, please leave user name and password blank.
...Good job I should have mentioned you only need the username and password if you're running Health Monitoring and are receving mail from the services. ;-)