Hi,
I use the below code for sending mail. This is working fine in my local system. When I upload to my server it gives error:
[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) +1846
System.Web.Mail.SmtpMail.Send(MailMessage message) +150
RFPProject.RFPProjInclude.mailFunction.mailFunction1(Int32 ConferenceID, String FromID, String TOId, String CCTypeID, String MessageSubject, String MessageBody)
RFPProject.Web.UI.rfp_ForgotPassword.ButtonClick()
RFPProject.Web.UI.rfp_ForgotPassword.Page_Load(Object sender, EventArgs e)
System.Web.UI.Control.OnLoad(EventArgs e) +67
System.Web.UI.Control.LoadRecursive() +35
System.Web.UI.Page.ProcessRequestMain() +731
The code what I am using for sending mail:
MailMessage msgMail = new MailMessage();msgMail.To = TOId;
msgMail.Bcc = CCEmail;
msgMail.From = FromID;
msgMail.Subject = MessageSubject+ " from: " + host;
msgMail.BodyFormat = MailFormat.Html;
string strBody =TableVar; // "<html><body><b><font color=\'red\'><br>"+ MessageBogy +"</font></body></html>";
msgMail.Body = strBody;
//msgMail.Attachments.Add (new MailAttachment("C:\\Hari\\Desktop\\gm.jpg"));
SmtpMail.Send(msgMail);
return "MailSent";
Please help me for this