Weird CDO Error

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}
 
A

Andrew Robinson

James,

I asnwered this over in the framework.general group:

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

-Andrew
 
J

James

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}
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top