I try to send an email with ASP.NET which should be extremely easy but
it doesn't work and there is no answer anywhere on the net! Here is
my code:
Dim objMM as New MailMessage()
objMM.To = "foo@example.com" 'my email has been removed for protection
objMM.From = "foo@example.com"
objMM.BodyFormat = MailFormat.Text
objMM.Priority = MailPriority.Normal
objMM.Subject = "Email subject"
objMM.Body = "test"
' I have tried each of the following with no success:
'Specify to use the default Smtp Server
'SmtpMail.SmtpServer = ""
'SmtpMail.SmtpServer = "192.168.1.10"
'SmtpMail.SmtpServer = "Broken"
SmtpMail.SmtpServer = "localhost"
Try
SmtpMail.Send(objMM)
Catch ex As Exception
Response.Write(("The following exception occurred: " + ex.ToString()))
'check the InnerException
While Not (ex.InnerException Is Nothing)
Response.Write("--------------------------------")
Response.Write(("The following InnerException reported: " +
ex.InnerException.ToString()))
ex = ex.InnerException
End While
End Try
And this code throws the following exceptions:
The following exception occurred:
System.Reflection.TargetInvocationException: Exception has been thrown
by the target of an invocation. --->
System.Runtime.InteropServices.COMException (0x8007007F): The
specified procedure could not be found.
--- End of inner exception stack trace ---
at System.RuntimeType.InvokeDispMethod(String name, BindingFlags
invokeAttr, Object target, Object[] args, Boolean[] byrefModifiers,
Int32 culture, String[] namedParameters)
at System.RuntimeType.InvokeMember(String name, BindingFlags
invokeAttr, Binder binder, Object target, Object[] args,
ParameterModifier[] modifiers, CultureInfo culture, String[]
namedParameters)
at System.Web.Mail.CdoSysHelper.Send(MailMessage message)
at System.Web.Mail.SmtpMail.Send(MailMessage message)
at ASP.scavenger_aspx.Submit_Click(Object objSender, EventArgs
objEArgs) in c:\inetpub\wwwroot\rock-n-rave\scavenger.aspx:line
55--------------------------------The following InnerException
reported: System.Runtime.InteropServices.COMException (0x8007007F):
The specified procedure could not be found.
I think it's maybe something like a simple DLL installation issue.
Could be wrong! I'm running ASP.NET version 1.1 on Windows 2000. |