winforms - C# smtp configuration in system.net.mail -
winforms - C# smtp configuration in system.net.mail -
i have little winforms application sends notification emails. works fine outlook clients bombs if gmail/yahoo/windowslive address entered. i've seen many posts using system.web.mail , schemas visual studio 2010 gives me error when trying utilize (i'm assuming because of .net 2.0). possible configure smtp client code relay of these email providers?
im using system.net.mail mailmessage. configuration code below...
smtpclient mailsender = new smtpclient("smtp.myclient.com"); mailsender.enablessl = true; mailsender.send(message);
it works fine outlook clients because workstation (likely) logged active directory domain , exchange server "trusts" connection because of it.
you need add together user's credentials on mail service service, , you'll have them user:
mailsender.credentials = new networkcredential(username, password);
also, don't forget set port property ssl. providers don't utilize standard ones.
c# winforms smtpclient mailmessage
Comments
Post a Comment