About target invocatin exception..!!urgent..plz
-
Hai friends, I have a requirement that, I need to send mails through .net. But while I am sending I am getting an error message "Exception was thrown by target of invocation exception. How can I resolve this. could you please help me. My code is as follows. msg = new MailMessage(); msg.To = txtMailTo.Text; // to mail address. msg.From="Mail:"; msg.Subject=txtMailSubject.Text ; // mail subject. msg.Body= txtMailBody.Text; // mail body. msg.Priority = MailPriority.Normal; msg.Headers.Add("Mail","Mail"); SmtpMail.SmtpServer=(string)ConfigurationSettings.AppSettings["SmtpServer"]; SmtpMail.Send(msg); ' Thanks and Regards. Gowtham Sen.
-
Hai friends, I have a requirement that, I need to send mails through .net. But while I am sending I am getting an error message "Exception was thrown by target of invocation exception. How can I resolve this. could you please help me. My code is as follows. msg = new MailMessage(); msg.To = txtMailTo.Text; // to mail address. msg.From="Mail:"; msg.Subject=txtMailSubject.Text ; // mail subject. msg.Body= txtMailBody.Text; // mail body. msg.Priority = MailPriority.Normal; msg.Headers.Add("Mail","Mail"); SmtpMail.SmtpServer=(string)ConfigurationSettings.AppSettings["SmtpServer"]; SmtpMail.Send(msg); ' Thanks and Regards. Gowtham Sen.
-
Hi there, You may want to troubleshoot your issue with the help of the site http://www.systemwebmail.com[^]
Hi, Thanks a lot. But I have already visited that site. But I didn't find any solution. Could you please give me some other idea. Thanks and Regards Gowtham sen.
-
Hi, Thanks a lot. But I have already visited that site. But I didn't find any solution. Could you please give me some other idea. Thanks and Regards Gowtham sen.
using system.net.mail; MailMessage mmsg = new MailMessage(); mmsg.From= new MailAddress("from address"); mmsg.To.Add("to address"); mmsg.Subject = "simple email"; mmsg.Body = "this is the message body"; SmtpClient smtp1 = new SmtpClient("sever name"); try { smtp1.Send(mmsg); }catch(Exception ex){} try above code.