F
fhranck
hello
I am using the following code in a windows .net application
and it returns me:
"Exception has been thrown by the target of an invocation."
---------------- code
MailMessage msg=new MailMessage();
message.From="email";
message.To="email";
message.Subject="test" ;
message.Body="test";
SmtpMail.SmtpServer="smtp.email.com";
SmtpMail.Send(msg);
------------------
I tried severall things disabeld the firewall
even copied and paste this code in a webform and it worked!!!!
this code is only not working in a windows application....
The exception is :
InnerException {System.Runtime.InteropServices.COMException}
System.Exception Message
"Exception has been thrown by the target of an invocation."
Source "mscorlib"
StackTrace " 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.Type.InvokeMember(String name, BindingFlags invokeAttr, Binder
binder, Object target, Object[] args)
at System.Web.Mail.LateBoundAccessHelper.CallMethod(Type type, Object
obj, String methodName, Object[] args)
at System.Web.Mail.LateBoundAccessHelper.CallMethod(Object obj, String
methodName, Object[] args)"
any ideas?
Thanks for your help
I am using the following code in a windows .net application
and it returns me:
"Exception has been thrown by the target of an invocation."
---------------- code
MailMessage msg=new MailMessage();
message.From="email";
message.To="email";
message.Subject="test" ;
message.Body="test";
SmtpMail.SmtpServer="smtp.email.com";
SmtpMail.Send(msg);
------------------
I tried severall things disabeld the firewall
even copied and paste this code in a webform and it worked!!!!
this code is only not working in a windows application....
The exception is :
InnerException {System.Runtime.InteropServices.COMException}
System.Exception Message
"Exception has been thrown by the target of an invocation."
Source "mscorlib"
StackTrace " 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.Type.InvokeMember(String name, BindingFlags invokeAttr, Binder
binder, Object target, Object[] args)
at System.Web.Mail.LateBoundAccessHelper.CallMethod(Type type, Object
obj, String methodName, Object[] args)
at System.Web.Mail.LateBoundAccessHelper.CallMethod(Object obj, String
methodName, Object[] args)"
any ideas?
Thanks for your help