Hi,
We are experiencing a problem with the MailEnable Email server in a website we have developed and is hosted in a dedicated server. MailEnable has been installed there by the Hosting Company and we do not have access to its configuration etc.
Mails are being sent to <anyaddress>@digiavenues.com but whenever I try to send email to any other server like yahoo or msn the following exception is thrown.
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 (0x8004020F): The server rejected one or more recipient addresses. The server response was: 501 This system is not configured to relay mail from to for 66.242.152.231 --- 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.TestMail_aspx.Page_Load(Object sender, EventArgs e)
I am using the following code snippet:
//C#
//--------------------------------------------------------------------------------
...
using System.Web.Mail;
...
MailMessage mail = new MailMessage();
mail.To = "smukherjee@digiavenues.com"; //Works
//mail.To = "smukherjee2002@msn.com"; //Does not Work
mail.From = "admin@benchmarkdental.com";
mail.Subject = "This is a test mail";
mail.Body = "some text goes here";
SmtpMail.SmtpServer = "mail.benchmarkdental.com";
SmtpMail.Send(mail);
//--------------------------------------------------------------------------------
Any help will be highly appreciated. Thanks.
Mail not being sent to certain servers
Mail not being sent to certain servers
Santanu M
Another error
Hi,
As per your suggestion, I tried to supply the login credentials in my code.
The code is given below:
//C#
...
try
{
MailMessage mail = new MailMessage();
mail.BodyFormat = MailFormat.Text;
mail.From = "admin@benchmarkdental.com";
mail.Fields["http://schemas.microsoft.com/cdo/config ... smtpserver"] = "mail.benchmarkdental.com";
mail.Fields["http://schemas.microsoft.com/cdo/config ... serverport"] = 25;
mail.Fields["http://schemas.microsoft.com/cdo/config ... /sendusing"] = 2;
mail.Fields["http://schemas.microsoft.com/cdo/config ... thenticate"] = 1;
mail.Fields["http://schemas.microsoft.com/cdo/config ... ndusername"] = "<username>";
mail.Fields["http://schemas.microsoft.com/cdo/config ... ndpassword"] = "<password>";
mail.Subject = "this is a test email.";
mail.Body = "Some text goes here";
mail.To = "smukherjee2002@msn.com";
SmtpMail.SmtpServer = "mail.benchmarkdental.com";
SmtpMail.Send( mail );
}
catch(Exception ex)
{
Response.Write(ex.ToString());
}
...
----------------------------------------------------------------------
When I run this code an exception is thrown:
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 (0x80040211): The message could not be sent to the SMTP server. The transport error code was 0x80040217. The server response was not available --- 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.TestMail_aspx.Page_Load(Object sender, EventArgs e)
Help needed.
As per your suggestion, I tried to supply the login credentials in my code.
The code is given below:
//C#
...
try
{
MailMessage mail = new MailMessage();
mail.BodyFormat = MailFormat.Text;
mail.From = "admin@benchmarkdental.com";
mail.Fields["http://schemas.microsoft.com/cdo/config ... smtpserver"] = "mail.benchmarkdental.com";
mail.Fields["http://schemas.microsoft.com/cdo/config ... serverport"] = 25;
mail.Fields["http://schemas.microsoft.com/cdo/config ... /sendusing"] = 2;
mail.Fields["http://schemas.microsoft.com/cdo/config ... thenticate"] = 1;
mail.Fields["http://schemas.microsoft.com/cdo/config ... ndusername"] = "<username>";
mail.Fields["http://schemas.microsoft.com/cdo/config ... ndpassword"] = "<password>";
mail.Subject = "this is a test email.";
mail.Body = "Some text goes here";
mail.To = "smukherjee2002@msn.com";
SmtpMail.SmtpServer = "mail.benchmarkdental.com";
SmtpMail.Send( mail );
}
catch(Exception ex)
{
Response.Write(ex.ToString());
}
...
----------------------------------------------------------------------
When I run this code an exception is thrown:
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 (0x80040211): The message could not be sent to the SMTP server. The transport error code was 0x80040217. The server response was not available --- 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.TestMail_aspx.Page_Load(Object sender, EventArgs e)
Help needed.
Santanu M
Working!!!
Hi,
Ultimately it worked with the following code snippet:
try
{
MailMessage mail = new MailMessage();
mail.BodyFormat = MailFormat.Text;
mail.From = "admin@benchmarkdental.com";
mail.Fields["http://schemas.microsoft.com/cdo/config ... thenticate"] = 1;
mail.Fields["http://schemas.microsoft.com/cdo/config ... ndusername"] = "<username>";
mail.Fields["http://schemas.microsoft.com/cdo/config ... ndpassword"] = "<password>";
mail.Subject = "this is a test email.";
mail.Body = "Some text goes here";
mail.To = "smukherjee1976@yahoo.com";
SmtpMail.SmtpServer = "benchmarkdental.com";
SmtpMail.Send( mail );
}
catch(Exception ex)
{
Response.Write(ex.ToString());
}
----------------------------------------------------------------
There is a small problem though. I found that in msn the message was in the Junk Mail folder. Any clues?
Anyway, thanks very very much for your help. It is really a good forum.
Thanks again.
Ultimately it worked with the following code snippet:
try
{
MailMessage mail = new MailMessage();
mail.BodyFormat = MailFormat.Text;
mail.From = "admin@benchmarkdental.com";
mail.Fields["http://schemas.microsoft.com/cdo/config ... thenticate"] = 1;
mail.Fields["http://schemas.microsoft.com/cdo/config ... ndusername"] = "<username>";
mail.Fields["http://schemas.microsoft.com/cdo/config ... ndpassword"] = "<password>";
mail.Subject = "this is a test email.";
mail.Body = "Some text goes here";
mail.To = "smukherjee1976@yahoo.com";
SmtpMail.SmtpServer = "benchmarkdental.com";
SmtpMail.Send( mail );
}
catch(Exception ex)
{
Response.Write(ex.ToString());
}
----------------------------------------------------------------
There is a small problem though. I found that in msn the message was in the Junk Mail folder. Any clues?
Anyway, thanks very very much for your help. It is really a good forum.
Thanks again.
Santanu M