Weird CDO Error

  • Thread starter Thread starter James
  • Start date Start date
J

James

Using ASP.NET, I have the following code:

SmtpMail.SmtpServer = "ourmailserver.com"

msgMail.To = "(e-mail address removed)"

msgMail.Attachments.Add(New MailAttachment(SaveLocation))

msgMail.From = "(e-mail address removed)"
msgMail.Subject = tbSubject.Text
msgMail.BodyFormat = MailFormat.Html
msgMail.Body = "Whatever"
msgMail.Send

This works fine when I'm attaching a small word document or if I remove the
attachment line entirely. However, if I try to attach a PDF to an e-mail, I
get the exception below. I tried using:

SmtpMail.SmtpServer.Insert(0, "ourmailserver.com")

....and the exception disappears, but the email never sends.

{System.Reflection.TargetInvocationException}

[System.Reflection.TargetInvocationException]:
{System.Reflection.TargetInvocationException}

HelpLink: Nothing

InnerException: {System.Runtime.InteropServices.COMException}

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)"

TargetSite: {System.Reflection.RuntimeMethodInfo}
 
James,

I asnwered this over in the framework.general group:

Have you checked your max message size under the IIS / SMTP properties?

-Andrew
 
My attachment is no where near 10 MB...you misread my initial attachment
size.

Andrew Robinson said:
James,

I asnwered this over in the framework.general group:

Have you checked your max message size under the IIS / SMTP properties?

-Andrew

James said:
Using ASP.NET, I have the following code:

SmtpMail.SmtpServer = "ourmailserver.com"

msgMail.To = "(e-mail address removed)"

msgMail.Attachments.Add(New MailAttachment(SaveLocation))

msgMail.From = "(e-mail address removed)"
msgMail.Subject = tbSubject.Text
msgMail.BodyFormat = MailFormat.Html
msgMail.Body = "Whatever"
msgMail.Send

This works fine when I'm attaching a small word document or if I remove
the attachment line entirely. However, if I try to attach a PDF to an
e-mail, I get the exception below. I tried using:

SmtpMail.SmtpServer.Insert(0, "ourmailserver.com")

...and the exception disappears, but the email never sends.

{System.Reflection.TargetInvocationException}

[System.Reflection.TargetInvocationException]:
{System.Reflection.TargetInvocationException}

HelpLink: Nothing

InnerException: {System.Runtime.InteropServices.COMException}

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)"

TargetSite: {System.Reflection.RuntimeMethodInfo}
 
Back
Top