Click here to Skip to main content
14,383,185 members
Rate this:
Please Sign up or sign in to vote.
See more:
hi everybody,
i have serious problem in my web site.
i had use some sort of code to send email in my website.the problem is that code works properly in one page and don't work on the other page.
i'm completely confused.
the code behind and web.config :

MailMessage mail = new MailMessage();
 mail.From = new MailAddress("");
mail.Subject = txtSubject.Text;
 mail.Body = "<div>something...</div>";
 mail.IsBodyHtml = true;
SmtpClient smtp = new SmtpClient("");
smtp.Credentials = new NetworkCredential("","password");

W E B . C O N F I G

<pre lang="xml"><>
        <network defaultCredentials="false"/>

every solution will be appreciated
Sandeep Mewara 5-Oct-10 16:51pm
Elaborate 'not working' ?
Ankur\m/ 6-Oct-10 5:34am
Please do not add answer if you need to clarify something with the answerer. He doesn't get notified. Instead use 'Add Comment' below his answer like I did.

1 solution

Rate this:
Please Sign up or sign in to vote.

Solution 1

Hi What you mean by code works on one page and not in other page may be it is copy paste problem on code behind file, did you check the control ids, namespace included properly, place break point and see whether proper values are coming
Ankur\m/ 6-Oct-10 5:32am
[moved from answer]
M0$!98 wrote:
thanks for ur answer.
ya i know what u mean.i check everything and they are correct.
plz let me know if there is something about web.config or mailserver
i think the code is right am i wrong!?!?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100