Hi
I'm trying to send an email using the following code in an ASP.NET 2.0 form.
Can some one tell me why the email doesn\t arrive at the destination and wy
the form tries to update but never finishes updating. THe progress bar in
IEs status bar never finish. There's no exception or any thing.
Here's the code.
protected void pbSendEmail_Click(object sender, EventArgs e)
{
MailMessage Msg = new MailMessage();
NameValueCollection Headers = new NameValueCollection();
MailAddress Address = new MailAddress(tbEmail.Text);
MailAddress ReplyTo = new MailAddress(tbEmail.Text);
SmtpClient MC = new SmtpClient();
Headers.Set("Header", "aHeader");
Headers.Set("Footer", "aFooter");
Headers.Set("From", tbEmail.Text);
Headers.Set("Sender", tbEmail.Text);
Headers.Set("Message", "aMessage");
Headers.Set("Body", tbMessage.Text);
Msg.Body = tbMessage.Text;
Msg.Headers.Add(Headers);
Msg.To.Add("Lars@mydmain.com");
Msg.From = Address;
Msg.ReplyTo = ReplyTo;
Msg.Bcc.Add("Add@mydmain.com");
MC.Host = "mailout.telia.com";
MC.Port = 25;
try
{
MC.Send(Msg);
}
catch(Exception ex)
{
tbMessage.Text = tbMessage.Text + "\n\n\n\nError Sending
message\n\n" + ex.Message;
}
}
Lars
sloan - 05 Mar 2008 19:19 GMT
You can try this blog entry:
Go here;
http://sholliday.spaces.live.com/Blog/cns!A68482B9628A842A!138.entry
get the downloadable code.
(You can download the code HERE. (Right-Click and "Save As" works best)
(<<key phrase to search for)
It could be trying to find the smtp server, and its taking a (long) while??
> Hi
>
[quoted text clipped - 42 lines]
>
> Lars