-
sorry this is vb not asp, but i get faster responses here..
and is vb related some how..
here is my mail function
Code:
Function SendEmail( sEmailServer, sFromEmail, sToEmail, sSubject, sText )
Dim objMail
Set objMail = CreateObject("Persits.MailSender")
objMail.From = sFromEmail
objMail.Host = sEmailServer
objMail.AddAddress sToEmail
objMail.Subject = sSubject
objMail.Body = sText
On Error Resume Next
objMail.Send
If Err <> 0 Then
SendEmail = "An error occurred: " & Err.Description
End If
Set objMail = nothing
End Function
i have that in a file and i include it with my asp page,s
since i dont get error including it... i assume it includes the file correctlly...
and i try to call the function from my asp pages as follow
Code:
errMsg = SendEmail("lndn1.on.wave.home.com", "[email protected]", Email, "1", "1" )
i get the following error
Code:
Error Type:
Microsoft VBScript runtime (0x800A000D)
Type mismatch: 'SendEmail'
anyone know why? thanks
-
Hi,
Not sure if it is the same in ASP but you haven't set hte function to be a type.
I have added to your code but I don't know whether it will work in ASP!!
Code:
Function SendEmail( sEmailServer, sFromEmail, sToEmail, sSubject, sText ) As String
Dim objMail
Set objMail = CreateObject("Persits.MailSender")
objMail.From = sFromEmail
objMail.Host = sEmailServer
objMail.AddAddress sToEmail
objMail.Subject = sSubject
objMail.Body = sText
On Error Resume Next
objMail.Send
If Err <> 0 Then
SendEmail = "An error occurred: " & Err.Description
Else
SendEmail ="OK"
End If
Set objMail = nothing
End Function
Hope this helps
Shaun
-
thanks for the reply
didn't make a difference...
-
hi,
just a thought...is errMsg a String type variable?
-
fixed it..
STUPID STUPID STUIPID ME
i for got to put <% %>
around my function
hehe
fixed thanks