DotNetGnat
Programmer
Hi Guys,
I have used this below script...
and i am bounced back with this error:
Any ideas? Actually we use exchange server in our company for sending emails and i am not sure whether we use SMTP server or not...how do i find out?
Thanks
-DNG
I have used this below script...
Code:
<script runat="server">
Sub btnSubmit_Click(sender as object, e as EventArgs)
Dim objEmail as New MailMessage()
objEmail.To = txtTo.Text
objEmail.From = txtFrom.Text
objEmail.Cc = txtCc.Text
objEmail.Subject = "Test Email"
objEmail.Body = txtName.Text & ", " &txtComments.Text
objEmail.Priority = MailPriority.High
SmtpMail.SmtpServer = "myservername"
try
SmtpMail.Send(objEMail)
Response.Write(Your E-mail has been sent sucessfully - Thank You)
catch exc as Exception
Response.Write("Send failure: " + exc.ToString())
End Try
End Sub
</script>
and i am bounced back with this error:
Code:
Send failure: System.Web.HttpException: Could not access 'CDO.Message' object. ---> System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.Runtime.InteropServices.COMException (0x80040213): The transport failed to connect to the server. --- 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.LateBoundAccessHelper.CallMethod(Object obj, String methodName, Object[] args) --- End of inner exception stack trace --- at System.Web.Mail.LateBoundAccessHelper.CallMethod(Object obj, String methodName, Object[] args) at System.Web.Mail.CdoSysHelper.Send(MailMessage message) at System.Web.Mail.SmtpMail.Send(MailMessage message) at ASP.Email_ascx.btnSubmit_Click(Object sender, EventArgs e) in c:\inetpub\[URL unfurl="true"]wwwroot\MyTemplate\Email.ascx:line[/URL] 19
Any ideas? Actually we use exchange server in our company for sending emails and i am not sure whether we use SMTP server or not...how do i find out?
Thanks
-DNG