Sign In| Join
Get Help:Ask a Question in our Forums|Report a Bug|More Help Resources
Last post Dec 23, 2012 03:01 PM by arun banik
Member
47 Points
103 Posts
Dec 22, 2012 02:56 PM|LINK
Hi
I have troubles in code behind, I need to send an email after clicking a button. But my host is localhost now, and I am getting an error...
I will type here some parts of codes, and if you'll see what is wrong, please help me.
This is written in my button click event:
System.Net.Mail.SmtpClient _smtpClient = new System.Net.Mail.SmtpClient(); _smtpClient.Send(mailMessage);
and this one in my .config file:
<system.net> <mailSettings> <smtp> <network host="127.0.0.1" port="25" />
The error is that the target computer's reject the request
Star
8837 Points
1699 Posts
Dec 22, 2012 04:40 PM|LINK
You need to have installed IIS and SMTP server on your PC
http://support.microsoft.com/kb/974877/en-us
100 Points
21 Posts
Dec 23, 2012 03:01 PM|LINK
Write this code in web.config file
<system.net> <mailSettings> <smtp deliveryMethod="SpecifiedPickupDirectory"> <specifiedPickupDirectory pickupDirectoryLocation="D:\MyTest"/> </smtp> </mailSettings> </system.net>
Also check this link for sending emails using "SmtpClient()"
http://www.encodedna.com/2012/11/Send_Emails_Using_ASPDOTNET.htm
AniMaks
Member
47 Points
103 Posts
sending an email from localhost
Dec 22, 2012 02:56 PM|LINK
Hi
I have troubles in code behind, I need to send an email after clicking a button. But my host is localhost now, and I am getting an error...
I will type here some parts of codes, and if you'll see what is wrong, please help me.
This is written in my button click event:
and this one in my .config file:
The error is that the target computer's reject the request
Primillo
Star
8837 Points
1699 Posts
Re: sending an email from localhost
Dec 22, 2012 04:40 PM|LINK
You need to have installed IIS and SMTP server on your PC
http://support.microsoft.com/kb/974877/en-us
Primillo
http://www.facebook.com/programandopuntonet
arun banik
Member
100 Points
21 Posts
Re: sending an email from localhost
Dec 23, 2012 03:01 PM|LINK
Write this code in web.config file
<system.net>
<mailSettings>
<smtp deliveryMethod="SpecifiedPickupDirectory">
<specifiedPickupDirectory pickupDirectoryLocation="D:\MyTest"/>
</smtp>
</mailSettings>
</system.net>
Also check this link for sending emails using "SmtpClient()"
http://www.encodedna.com/2012/11/Send_Emails_Using_ASPDOTNET.htm