|
-
Jan 12th, 2008, 06:19 AM
#1
Thread Starter
Member
sending mails
I try to use the following code to send mails but gives me the error :
"A first chance exception of type 'System.Web.HttpException' occurred in System.Web.dll"
Imports System
Imports System.Web.Mail
Public Class Form2
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim oMsg As Web.Mail.MailMessage = New Web.Mail.MailMessage()
oMsg.From = "[email protected]"
oMsg.To = "[email protected]"
oMsg.Subject = "Email with Attachment Demo"
oMsg.Body = "This is the main body of the email"
Try
SmtpMail.SmtpServer = "pop.gmail.com"
SmtpMail.Send(oMsg)
Catch ehttp As System.Web.HttpException
Console.WriteLine("0", ehttp.Message)
Console.WriteLine("Here is the full error message")
Console.Write("0", ehttp.ToString())
End Try
End Sub
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|