|
-
Jan 27th, 2003, 08:08 PM
#1
Thread Starter
New Member
Error in E-mail Code
I get this message when i use either of the codes at the bottom of this thread, can anyone help me out?
The coding that is highlighted in the first code is "End With" and the coding that is highlighted in the second code is "System.Web.Mail.SmtpMail.Send(mailMessage)"
I used to get an error from not having Web.dll as my reference but i fixed that and now this is my problem
Any Ideas?
Thanks a lot
Dan
Error:
An unhandled exception of type 'System.Web.HttpException' occurred in system.web.dll
Additional information: Could not access 'CDO.Message' object.
Code Used:
Dim m As New System.Web.Mail.MailMessage()
With m
.From = "[email protected]"
.To = "myself$my.house"
.Subject = "My SMTP Test"
.Body = "My New Message"
End With
SmtpMail.SmtpServer = "www.digitalims.net"
SmtpMail.Send(m)
Or the other code:
Dim mailMessage As System.Web.Mail.MailMessage = New System.Web.Mail.MailMessage()
mailMessage.From = "[email protected]"
mailMessage.To = "[email protected]"
mailMessage.Subject = "Email Subject"
mailMessage.BodyFormat = System.Web.Mail.MailFormat.Text
System.Web.Mail.SmtpMail.SmtpServer = "localhost"
System.Web.Mail.SmtpMail.Send(mailMessage)
-
Jan 27th, 2003, 08:30 PM
#2
Sleep mode
is this object exist in your code "CDO.Message'" ??
-
Jan 27th, 2003, 08:48 PM
#3
Thread Starter
New Member
CDO.Message appears no where in my code, the code you see is the exact code i used to try and get it to work, All i did was make a form, load Web.dll references to get the second code to work, and made that code proccess with a command button...... CDO.Message is not an object of 'System.Web.HttpException' ? i really have no idea whats going on.....????
-
Jan 27th, 2003, 08:55 PM
#4
Sleep mode
I bet this will work......
VB Code:
Private Function EmailCust(ByVal Email As String, ByVal msgBody As String) As Boolean
Dim myMessage As New Mail.MailMessage()
Dim myMailServer As Mail.SmtpMail
myMessage.To = Email
myMessage.Subject = "You subject here"
myMessage.Body = msgBody
myMailServer.SmtpServer = "your mail server here"
myMailServer.Send(myMessage)
myMessage = Nothing
Return True
End Function
-
Jan 27th, 2003, 10:24 PM
#5
Thread Starter
New Member
Ok now i got that code to work right with a little modification
but how do i get a private function to work as like a command button?
If i figure this out before you read this i'll post again....
new code:
Private Function EmailCust(ByVal Email As String, ByVal msgBody As String) As Boolean
Dim myMessage As New System.Web.Mail.MailMessage()
Dim myMailServer As System.Web.Mail.SmtpMail
myMessage.To = Email
myMessage.From = "[email protected]"
myMessage.Subject = "You subject here"
myMessage.Body = msgBody
myMailServer.SmtpServer = "www.digitalims.net"
myMailServer.Send(myMessage)
myMessage = Nothing
Return True
End Function
-
Jan 27th, 2003, 10:28 PM
#6
Sleep mode
Originally posted by HisAirness
Ok now i got that code to work right with a little modification
but how do i get a private function to work as like a command button?
If i figure this out before you read this i'll post again....
new code:
Private Function EmailCust(ByVal Email As String, ByVal msgBody As String) As Boolean
Dim myMessage As New System.Web.Mail.MailMessage()
Dim myMailServer As System.Web.Mail.SmtpMail
myMessage.To = Email
myMessage.From = "[email protected]"
myMessage.Subject = "You subject here"
myMessage.Body = msgBody
myMailServer.SmtpServer = "www.digitalims.net"
myMailServer.Send(myMessage)
myMessage = Nothing
Return True
End Function
What do you mean ? What are you trying to do ?
-
Jan 27th, 2003, 10:31 PM
#7
Thread Starter
New Member
I'm trying to make a button that after the user has entered information it will take that info and send it in an e-mail, once i got this working I figured i could just manipulate the body text of the e-mail to include the info....
-
Jan 27th, 2003, 10:38 PM
#8
Sleep mode
VB Code:
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
End Sub
is this what you mean ?
-
Jan 27th, 2003, 10:47 PM
#9
Thread Starter
New Member
Thanks for the replys
Getting that damn message again and it highlights almost the same exact thing
myMailServer.Send(myMessage)
I looked it up and the index says that the CDO is installed with outlook and i don't need to install it, maybe i do? maybe someone out there gets this error message?
Any ideas?
-
Jan 27th, 2003, 11:19 PM
#10
Sleep mode
-
Jan 27th, 2003, 11:31 PM
#11
Thread Starter
New Member
Yeah i think i know the problem now its the cdosys.dll file, the guy had a problem with it because it became un-registered, anyway how do you re-register a file? do i just reinstall it on my computer?
-
Jan 28th, 2003, 12:00 AM
#12
Sleep mode
umm , is it one of OutLook Files ??
-
Jan 28th, 2003, 12:14 AM
#13
Sleep mode
c:\WINDOWS\system32\regsvr32 cdosys.dll . this for XP
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
|