CDONTS Attachfile error
Web Server forum
Back To The Forum Home!Search!Private Messaging System

Web Server Talk Web Server Talk > Web Servers reviews > IIS server support > IIS and SMTP > CDONTS Attachfile error




  Last Thread   Next Thread Next
  Show Printable Version Email this Page Subscribe to this Thread      Post New Thread    Post A Reply      

    CDONTS Attachfile error  
lankylad


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
09-16-05 11:00 PM

I am getting the message -2147467259 Method '~' of object '~' failed when I
try to attach a file into an email. The code is as follows

Set Mailer = CreateObject("CDONTS.Newmail")
Mailer.AttachFile zippedfilename
Mailer.To = EmailAddress
Mailer.From = EmailFrom
Mailer.Subject = Emailsubject
Mailer.Body = ""
Mailer.Send
Set Mailer = Nothing

The error happens on the second line. If I take this line away then the
email is sent successfully.

Any ideas?





[ Post a follow-up to this message ]



    Re: CDONTS Attachfile error  
Al Mulnick


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
09-16-05 11:00 PM

Syntax most likely.  IIRC, you have to define three options with the
attachfile (path, name to display, encoding method).
Your zippedfilename attribute should equate to a full path to the file such
as "c:\temp\filename.zip" or similar.

Here's a nice walk through if it helps:
http://www.devguru.com/features/tut...NTS/cdonts.html

And the def for attachfile is:
http://msdn.microsoft.com/library/d...e0396f0d7d1.asp

Al

"lankylad" <lankylad@discussions.microsoft.com> wrote in message
news:A33EAE6B-C25D-4AF1-BC89-24A66B000B68@microsoft.com...
>I am getting the message -2147467259 Method '~' of object '~' failed when I
> try to attach a file into an email. The code is as follows
>
> Set Mailer = CreateObject("CDONTS.Newmail")
> Mailer.AttachFile zippedfilename
> Mailer.To = EmailAddress
> Mailer.From = EmailFrom
> Mailer.Subject = Emailsubject
> Mailer.Body = ""
> Mailer.Send
> Set Mailer = Nothing
>
> The error happens on the second line. If I take this line away then the
> email is sent successfully.
>
> Any ideas?







[ Post a follow-up to this message ]



    Re: CDONTS Attachfile error  
lankylad


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
09-16-05 11:00 PM

I have changed the code to the following, but get the same error. The
zipfilename is a full path to the file

Dim Mailer
Set Mailer = CreateObject("CDONTS.Newmail")
Mailer.MailFormat = 0
Mailer.AttachFile zippedfilename, "Zipped File", 1
Mailer.To = EmailAddress
Mailer.From = Emailsubject
Mailer.Subject = Emailsubject
Mailer.Body = ""
Mailer.Send
Set Mailer = Nothing

"Al Mulnick" wrote:

> Syntax most likely.  IIRC, you have to define three options with the
> attachfile (path, name to display, encoding method).
> Your zippedfilename attribute should equate to a full path to the file suc
h
> as "c:\temp\filename.zip" or similar.
>
> Here's a nice walk through if it helps:
> http://www.devguru.com/features/tut...NTS/cdonts.html
>
> And the def for attachfile is:
> http://msdn.microsoft.com/library/d...e0396f0d7d1.asp
>
> Al
>
> "lankylad" <lankylad@discussions.microsoft.com> wrote in message
> news:A33EAE6B-C25D-4AF1-BC89-24A66B000B68@microsoft.com... 
>
>
>





[ Post a follow-up to this message ]



    Re: CDONTS Attachfile error  
Al Mulnick


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
09-16-05 11:00 PM

The syntax can be tricky when you do that. For now, how about substituting
the variable with the actual path name? Then, just to see the variable at
run time, try the following code (note the fix to the Mailer.From because
you would have the subject as the sender in your post   Because you set
the attachment type, it's not necessary to set the Mailer.MailFormat
information. It'll default.

Set Mailer = CreateObject("CDONTS.NewMail")
Call Mailer.AttachFile("\\server\schedule\sched.xls", "SCHED.XLS",1)
Mailer.Send "Automated Schedule Generator", "user1@example.com", _
"Schedule", "Here's the new schedule", 0
Set Mailer = Nothing


This example comes from
http://msdn.microsoft.com/library/d...e0396f0d7d1.asp
if you're interested.

Do you get the same results? Any particular reason you're writing this to a
2000 or older OS?


Al




"lankylad" <lankylad@discussions.microsoft.com> wrote in message
news:FC042128-105C-4DBF-A825-0EEA38A9154B@microsoft.com...[vbcol=seagreen]
>I have changed the code to the following, but get the same error. The
> zipfilename is a full path to the file
>
> Dim Mailer
> Set Mailer = CreateObject("CDONTS.Newmail")
> Mailer.MailFormat = 0
> Mailer.AttachFile zippedfilename, "Zipped File", 1
> Mailer.To = EmailAddress
> Mailer.From = Emailsubject
> Mailer.Subject = Emailsubject
> Mailer.Body = ""
> Mailer.Send
> Set Mailer = Nothing
>
> "Al Mulnick" wrote:
> 







[ Post a follow-up to this message ]



    Sponsored Links  




 





   All times are GMT. The time now is 06:53 PM.      Post New Thread    Post A Reply      
  Last Thread   Next Thread Next


Most Popular forums 

Forum Jump:
Rate This Thread:

Forum Rules:
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is OFF
vB code is ON
Smilies are ON
[IMG] code is OFF
 
Medical and Health forum | Computer Games Reviews | Graphics design forum

Back To The Top
Home | Usercp | Faq | Register