Click to See Complete Forum and Search --> : sending mail


aquafin
November 8th, 2005, 10:00 PM
I get an error when trying to send mail

here is my code
Dim MailMessage As New MailMessage
MailMessage.To = "Aqua@aqua.com"
MailMessage.From = txtFrom.Text
MailMessage.Subject = txtSubject.Text

MailMessage.Body = txtBody.Text

SmtpMail.Send(MailMessage)


here is the error:


Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.Runtime.InteropServices.COMException: The "SendUsing" configuration value is invalid.

Source Error:


Line 40: MailMessage.Body = txtBody.Text
Line 41:
Line 42: SmtpMail.Send(MailMessage)
Line 43: End Sub
Line 44: End Class


Source File: C:\Inetpub\wwwroot\Elearning\FrmFeedback.aspx.vb Line: 42

Stack Trace:


[COMException (0x80040220): The "SendUsing" configuration value is invalid.
]

[TargetInvocationException: Exception has been thrown by the target of an invocation.]
System.RuntimeType.InvokeDispMethod(String name, BindingFlags invokeAttr, Object target, Object[] args, Boolean[] byrefModifiers, Int32 culture, String[] namedParameters) +0
System.RuntimeType.InvokeMember(String name, BindingFlags invokeAttr, Binder binder, Object target, Object[] args, ParameterModifier[] modifiers, CultureInfo culture, String[] namedParameters) +473
System.Web.Mail.LateBoundAccessHelper.CallMethod(Object obj, String methodName, Object[] args) +58

[HttpException (0x80004005): Could not access 'CDO.Message' object.]
System.Web.Mail.LateBoundAccessHelper.CallMethod(Object obj, String methodName, Object[] args) +111
System.Web.Mail.CdoSysHelper.Send(MailMessage message) +1861
System.Web.Mail.SmtpMail.Send(MailMessage message) +150
Elearning.FrmFeedback.BtnFeed_Click(Object sender, EventArgs e) in C:\Inetpub\wwwroot\Elearning\FrmFeedback.aspx.vb:42
System.Web.UI.WebControls.Button.OnClick(EventArgs e) +108
System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +57
System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +18
System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +33
System.Web.UI.Page.ProcessRequestMain() +1292


Could anyone help me ?

Rohit Kukreti
November 9th, 2005, 04:29 AM
http://www.codecomments.com/ASP_.NET/message679063.html

aquafin
November 9th, 2005, 09:37 PM
thanks for the response,
But that did not solve the problem ,

mmetzger
November 9th, 2005, 11:25 PM
Are you running a mail server locally and / or have one defined in a DNS MX record? If not, you need to define the mail server explicitly with the SmtpMail.SmtpServer property.