Thursday, 15 April 2010

c# - Send email using smtp -


I am trying to send emails outside of my domain network. I have done this within my company domain for months without any problem. Now I am trying to make customer email process easier by using code system.net.mail

  string recipient = "nobody@gmail.com"; String = "donutrayplay_modmen.com"; Mail message mail = new mailmax (from, recipient); Mail.Subject = "Your ..." Mail. Body = message; Mail.IsBodyHtml = True; SmtpClient Client = New SmtpClient ("mydomainip"); Client.port = 25; Client.UseDefaultCredentials = True; Client.Send (mail);  

I added this to the web config:

  & lt; System.net & gt; & Lt; MailSettings & gt; & Lt; Smtp delivery method = "network" & gt; & Lt; Network host = "maidomimep" port = "25" default credentials = "true" /> & Lt; / Smtp & gt; & Lt; / MailSettings & gt;  

Then I setup the IIS as a credential with domain IP in the host and windows. I am able to send emails while debugging on my computer, but once I publish the application in IIS, no email is coming, the application does not put any error and I received the message sent to me (I It is set in your application). Please note: We provide security for the web. Do not want to write server's credentials in config. Thanks


No comments:

Post a Comment