how do solve this error for sending mail in vb.net?

sathyan_8294

Member
Joined
Jun 13, 2007
Messages
5
Programming Experience
Beginner
i am using vb.net 2003.i am doing my project in vb.net windows application.the following code is for sending mail.

VB.NET:
Dim mymailmessage As New MailMessage
Try
Dim bSuccess As Boolean = True
mymailmessage.From = FromTextBox.Text
mymailmessage.To = "kumar@indocanapparel.com"
mymailmessage.Bcc = sb.ToString
mymailmessage.Subject = SubjectTextBox.Text
mymailmessage.Body = MessageTextBox.Text
mymailmessage.BodyFormat = MailFormat.Text
mymailmessage.Priority = MailPriority.Normal
SmtpMail.SmtpServer = "127.0.0.1"
SmtpMail.Send(mymailmessage)
DisplayLabel.Text = "Your Mail was Successfully Sent"
Catch ex As Exception
MessageBox.Show(ex.Message)

End Try
the above code,i written in vb.net windows application.
i run the project,then i click send button means,the following error is display.
"Could not access 'CDO.Message' object"
how to solve this?plz help.
 
(a) does your FromTextBox contain a valid email address? If it's just text like "John Smith" it won't work. Needs to be something like "john.smith@smiths.net"

(b) What's your BCC? sb.ToString? If it doesn't like this it's going to throw that error....

(c) Also need to make sure that your bodyformat is exactly how it should be - you're setting this it seems as a .text field, make sure the options match how they should be if you were hard coding them
 
Back
Top