i want to send mail to user when registered but error (The SMTP host was not specified) how to i configure smtp in web.config?
Asked
Active
Viewed 2.7k times
8
-
1can you show your code that sends the email – devdigital Mar 11 '12 at 11:14
-
-
Take a look at this page on Scott Gu's blog http://weblogs.asp.net/scottgu/archive/2005/12/10/432854.aspx – Robbie Mar 12 '12 at 19:38
1 Answers
24
You should add following in web.config file:
<system.net>
<mailSettings>
<smtp>
<network host="smtp.xxx.com" password="" userName=""/>
</smtp>
</mailSettings>
</system.net>
-
what is UserName? for example I have an email info@site.com. [info] is UserName? or [info@site.com] ? – AmirHossein Jan 30 '13 at 21:03
-
@AmirHossein No UserName and password are for using the SMTP server. This is often not required, but sometimes an SMTP server requires a UserName and Password. – Holger Mar 18 '13 at 16:40