Last post May 23, 2008 11:51 AM by yasserzaid
Nov 09, 2007 05:24 PM|therod0308|LINK
Having a lot of problems sending email. Here are my web.config settings:
Here is the code-behind:
Anyone see why I can't get this thing to send this email? Nothing ever shows up in the
Nov 09, 2007 07:35 PM|jimmy q|LINK
Are you getting any errors at all?
Check the logs on your SMTP mail server to see if the email is even being routed to it.
Nov 09, 2007 11:17 PM|therod0308|LINK
Actually, that was one of the problems. I wasn't getting any error messages and, therefore, I had no idea what was wrong.
As it turns out, I removed the "http://" from the SMTPClient definition and also from the network host setting in web.config. Everything now works like a champ.
Thanks for your help.
May 23, 2008 11:51 AM|yasserzaid|LINK
try this example
First create new website project and add two pages :-
SendEmail.aspx and EmailSent.aspx
and in the page SendEmail.aspx add three TextBox (txtFrom , txtSubject , txtMessage)
and add button (btn_Send) and Lable control
and Required Validator for txtFrom , txtSubject
public partial class SendEmail : System.Web.UI.Page
protected void Page_Load(object sender, EventArgs e)
private bool SendMail()
string strTo = "your email";
string strFrom = txtFrom.Text;
string strBody = txtMessage.Text ;
string strSubject = txtSubject.Text ;
SmtpMail.SmtpServer = ("your SMTP");
SmtpMail.Send(strFrom, strTo, strSubject, strBody);
catch (Exception ex)
protected void btn_Send_Click(object sender, EventArgs e)
bool TrueOrFalse = SendMail();
if ((TrueOrFalse == true))
Label1.Text = "Try again";