Send Mail Problems!!!

A

Arvind P Rangan

Hi,
How many have succesfully send mail using ASP.NEt.

Kindly give me the example.
I have code which uses the following.
The Code as follows:
Dim strBody As String = "This is the body of the e-mail"
Dim strFrom As String = (e-mail address removed)
Dim strTo As String = (e-mail address removed)
' Dim a MailPriority Type, valid values are
'Normal, Low and High
Dim mprPriority As MailPriority = MailPriority.High
Dim strSubject As String = "This is the subject of the e-mail."

' Create an instance of our MailMessage Object.
Dim theMailMessage As New MailMessage()

' Assign values to the MailMessage Objects fields.
theMailMessage.From = strFrom
theMailMessage.To = strTo
theMailMessage.Subject = strSubject
theMailMessage.Priority = mprPriority
theMailMessage.Body = strBody

'Send the MailMessage using the SmtpMail class' Send method.
SmtpMail.Send(theMailMessage)
Try
SmtpMail.Send(theMailMessage)
Catch ex As Exception
Response.Write(ex)
End Try

The Error I get is :

[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) +113
System.Web.Mail.CdoSysHelper.Send(MailMessage message) +1516
System.Web.Mail.SmtpMail.Send(MailMessage message) +49
WebTest.EMail.btSend_Click(Object sender, EventArgs e) in c:\inetpub\wwwroot\WebTest\EMail.aspx.vb:73
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() +1263

What is this Problem how to solve it.
Thanks
Arvind P Rangan.
 
C

Cor

Hi Arvind,
I sustpect it is your SMTP mailserver,
Although this is a strange line
SmtpMail.Send(theMailMessage)
Try
SmtpMail.Send(theMailMessage)

When you delete the first, you would not get the error I think, but probably no email either but a webpage.

I hope this helps a little bit.
Cor
 
S

steve

sendusing tells cdo how you plan to get this message to/from your web server and whether or not user/password validation is required to do so. i don't know if this will work for you, but this is a snippet of php code i use to email from a web page through my iis server and allows the server to be locked up tight w/ relaying turned off. notice i'm not storing validation info w/n my php page but am telling cdo to place the email message in the pickup directory...a bit more secure, but not much. there's a bunch of documentation on cdo on the msdn web site...you may want to find zen there. ;^)

hth,

steve

function cdoMail($to, $from, $cc, $bcc, $subject, $message){
$cdoSendUsingMethod = "http://schemas.microsoft.com/cdo/configuration/sendusing";
$cdoSMTPServerPickupDirectory = "http://schemas.microsoft.com/cdo/configuration/smtpserverpickupdirectory";
$cdoSendUsingPickup = 1;
$cdoPickupDirectory = "c:\inetpub\mailroot\pickup";
@$mail = new COM("CDO.Message.1");
@$mail->Configuration = new COM("CDO.Configuration");
@$mail->Configuration->Fields[$cdoSendUsingMethod]->Value = $cdoSendUsingPickup;
@$mail->Configuration->Fields[$cdoSMTPServerPickupDirectory]->Value = $cdoPickupDirectory;
@$mail->Configuration->Fields->Update();
@$mail->To = $to;
@$mail->From = $from;
@$mail->CC = $cc;
@$mail->BCC = $bcc;
@$mail->Subject = $subject;
@$mail->TextBody = $message;
@$mail->Send();
@com_release($mail->Configuration);
@com_release($mail);
}

Hi,
How many have succesfully send mail using ASP.NEt.

Kindly give me the example.
I have code which uses the following.
The Code as follows:
Dim strBody As String = "This is the body of the e-mail"
Dim strFrom As String = (e-mail address removed)
Dim strTo As String = (e-mail address removed)
' Dim a MailPriority Type, valid values are
'Normal, Low and High
Dim mprPriority As MailPriority = MailPriority.High
Dim strSubject As String = "This is the subject of the e-mail."

' Create an instance of our MailMessage Object.
Dim theMailMessage As New MailMessage()

' Assign values to the MailMessage Objects fields.
theMailMessage.From = strFrom
theMailMessage.To = strTo
theMailMessage.Subject = strSubject
theMailMessage.Priority = mprPriority
theMailMessage.Body = strBody

'Send the MailMessage using the SmtpMail class' Send method.
SmtpMail.Send(theMailMessage)
Try
SmtpMail.Send(theMailMessage)
Catch ex As Exception
Response.Write(ex)
End Try

The Error I get is :

[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) +113
System.Web.Mail.CdoSysHelper.Send(MailMessage message) +1516
System.Web.Mail.SmtpMail.Send(MailMessage message) +49
WebTest.EMail.btSend_Click(Object sender, EventArgs e) in c:\inetpub\wwwroot\WebTest\EMail.aspx.vb:73
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() +1263

What is this Problem how to solve it.
Thanks
Arvind P Rangan.
 
A

Arvind P Rangan

hi Steve,
Thanks i have not tried on those lines which you have mentioned.

But after setting up my smtp server i have able to get one more error Message:
The transport failed to connect to the server

What about this.
Can you tell me something about this.
Thanks
arvind.
sendusing tells cdo how you plan to get this message to/from your web server and whether or not user/password validation is required to do so. i don't know if this will work for you, but this is a snippet of php code i use to email from a web page through my iis server and allows the server to be locked up tight w/ relaying turned off. notice i'm not storing validation info w/n my php page but am telling cdo to place the email message in the pickup directory...a bit more secure, but not much. there's a bunch of documentation on cdo on the msdn web site...you may want to find zen there. ;^)

hth,

steve

function cdoMail($to, $from, $cc, $bcc, $subject, $message){
$cdoSendUsingMethod = "http://schemas.microsoft.com/cdo/configuration/sendusing";
$cdoSMTPServerPickupDirectory = "http://schemas.microsoft.com/cdo/configuration/smtpserverpickupdirectory";
$cdoSendUsingPickup = 1;
$cdoPickupDirectory = "c:\inetpub\mailroot\pickup";
@$mail = new COM("CDO.Message.1");
@$mail->Configuration = new COM("CDO.Configuration");
@$mail->Configuration->Fields[$cdoSendUsingMethod]->Value = $cdoSendUsingPickup;
@$mail->Configuration->Fields[$cdoSMTPServerPickupDirectory]->Value = $cdoPickupDirectory;
@$mail->Configuration->Fields->Update();
@$mail->To = $to;
@$mail->From = $from;
@$mail->CC = $cc;
@$mail->BCC = $bcc;
@$mail->Subject = $subject;
@$mail->TextBody = $message;
@$mail->Send();
@com_release($mail->Configuration);
@com_release($mail);
}

Hi,
How many have succesfully send mail using ASP.NEt.

Kindly give me the example.
I have code which uses the following.
The Code as follows:
Dim strBody As String = "This is the body of the e-mail"
Dim strFrom As String = (e-mail address removed)
Dim strTo As String = (e-mail address removed)
' Dim a MailPriority Type, valid values are
'Normal, Low and High
Dim mprPriority As MailPriority = MailPriority.High
Dim strSubject As String = "This is the subject of the e-mail."

' Create an instance of our MailMessage Object.
Dim theMailMessage As New MailMessage()

' Assign values to the MailMessage Objects fields.
theMailMessage.From = strFrom
theMailMessage.To = strTo
theMailMessage.Subject = strSubject
theMailMessage.Priority = mprPriority
theMailMessage.Body = strBody

'Send the MailMessage using the SmtpMail class' Send method.
SmtpMail.Send(theMailMessage)
Try
SmtpMail.Send(theMailMessage)
Catch ex As Exception
Response.Write(ex)
End Try

The Error I get is :

[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) +113
System.Web.Mail.CdoSysHelper.Send(MailMessage message) +1516
System.Web.Mail.SmtpMail.Send(MailMessage message) +49
WebTest.EMail.btSend_Click(Object sender, EventArgs e) in c:\inetpub\wwwroot\WebTest\EMail.aspx.vb:73
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() +1263

What is this Problem how to solve it.
Thanks
Arvind P Rangan.
 
C

Cor

Hi Herfried,
What's the difference?!
A more complete post of the OP beneath, to paste it before gives me problems
with my OE
And therefore the exception was not catched.
If is SMTP server would work he would send twice I think

'Send the MailMessage using the SmtpMail class' Send method.
SmtpMail.Send(theMailMessage)
Try
SmtpMail.Send(theMailMessage)
Catch ex As Exception
Response.Write(ex)
End Try
 
S

steve

go to the command prompt and type "netstat -an" and make sure port 25 is "listening".

sounds like your code may be fine and that you just need to get iis configured properly.


hi Steve,
Thanks i have not tried on those lines which you have mentioned.

But after setting up my smtp server i have able to get one more error Message:
The transport failed to connect to the server

What about this.
Can you tell me something about this.
Thanks
arvind.
sendusing tells cdo how you plan to get this message to/from your web server and whether or not user/password validation is required to do so. i don't know if this will work for you, but this is a snippet of php code i use to email from a web page through my iis server and allows the server to be locked up tight w/ relaying turned off. notice i'm not storing validation info w/n my php page but am telling cdo to place the email message in the pickup directory...a bit more secure, but not much. there's a bunch of documentation on cdo on the msdn web site...you may want to find zen there. ;^)

hth,

steve

function cdoMail($to, $from, $cc, $bcc, $subject, $message){
$cdoSendUsingMethod = "http://schemas.microsoft.com/cdo/configuration/sendusing";
$cdoSMTPServerPickupDirectory = "http://schemas.microsoft.com/cdo/configuration/smtpserverpickupdirectory";
$cdoSendUsingPickup = 1;
$cdoPickupDirectory = "c:\inetpub\mailroot\pickup";
@$mail = new COM("CDO.Message.1");
@$mail->Configuration = new COM("CDO.Configuration");
@$mail->Configuration->Fields[$cdoSendUsingMethod]->Value = $cdoSendUsingPickup;
@$mail->Configuration->Fields[$cdoSMTPServerPickupDirectory]->Value = $cdoPickupDirectory;
@$mail->Configuration->Fields->Update();
@$mail->To = $to;
@$mail->From = $from;
@$mail->CC = $cc;
@$mail->BCC = $bcc;
@$mail->Subject = $subject;
@$mail->TextBody = $message;
@$mail->Send();
@com_release($mail->Configuration);
@com_release($mail);
}

Hi,
How many have succesfully send mail using ASP.NEt.

Kindly give me the example.
I have code which uses the following.
The Code as follows:
Dim strBody As String = "This is the body of the e-mail"
Dim strFrom As String = (e-mail address removed)
Dim strTo As String = (e-mail address removed)
' Dim a MailPriority Type, valid values are
'Normal, Low and High
Dim mprPriority As MailPriority = MailPriority.High
Dim strSubject As String = "This is the subject of the e-mail."

' Create an instance of our MailMessage Object.
Dim theMailMessage As New MailMessage()

' Assign values to the MailMessage Objects fields.
theMailMessage.From = strFrom
theMailMessage.To = strTo
theMailMessage.Subject = strSubject
theMailMessage.Priority = mprPriority
theMailMessage.Body = strBody

'Send the MailMessage using the SmtpMail class' Send method.
SmtpMail.Send(theMailMessage)
Try
SmtpMail.Send(theMailMessage)
Catch ex As Exception
Response.Write(ex)
End Try

The Error I get is :

[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) +113
System.Web.Mail.CdoSysHelper.Send(MailMessage message) +1516
System.Web.Mail.SmtpMail.Send(MailMessage message) +49
WebTest.EMail.btSend_Click(Object sender, EventArgs e) in c:\inetpub\wwwroot\WebTest\EMail.aspx.vb:73
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() +1263

What is this Problem how to solve it.
Thanks
Arvind P Rangan.
 
H

Herfried K. Wagner [MVP]

Hello,

Cor said:
What's the difference?!
A more complete post of the OP beneath, to paste it before
gives me problems with my OE [...]
'Send the MailMessage using the SmtpMail class' Send method.
SmtpMail.Send(theMailMessage)
Try
SmtpMail.Send(theMailMessage)
Catch ex As Exception
Response.Write(ex)
End Try

Sorry, I misinterpreted your post.

;-)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top