Solved

help with CDOSYS attachments?

Posted on 2007-11-26
3
902 Views
Last Modified: 2012-08-14
HI, I've been reading about the change from CDONTS in w2003 to CDOSYS.
This causes me a problem as a useful parameter of CDONTS.NewMail.attachFile() doesnt seem to exist in CDOSYS.Message.addAttachment()

Situation is that my server is sending emails out really fast and some files sent out in successive emails are common in terms of content and name. The temporary  get deleted once sent but Windows doesnt always delete them instantly and I've hit timing problems where names are common.  

I needed to either
1) call the files by a GUID identity and pass that into the mail send as an attachment , but also pass its meaningful name into the email (ie attachFile ("\temp\F345626262A.xml", "invoice27.xml") so the recipient sees the meaningful name "invoice27.xml" in the email where the attachment is shown)
or else
2) Use a temporary folder called by a guid and store the file by its meaningful name in there, send, then delete the file and folder This works okay for Message.addAttachment() as the meaningful name is used, but I cant seem to delete the folder using ASP after the email send as the mail code isnt letting it go (error: "folder could not be removed").  If you comment out the single line of addAttachment() code , the folder is deleted without any issue.  
Obviously I cant just let these folders build up.

I have checked the parent folder's permissions and IWAM_(machine) and IUSR_(machine) have full permissions. CREATOR_OWNER has sufficient permissions. These are all passed on down to child folders.  I don't think there is a huge permissions problem anyway as the folders can be deleted if no attachment is actually sent.

Can anyone tell me how to get addAttachment() to accept a given file, but call it by another (ie meaningful) name within the actual email?  (ie as attachFile() did)
0
Comment
Question by:simonm0966
  • 2
3 Comments
 
LVL 11

Accepted Solution

by:
L00M earned 125 total points
ID: 20351571
With iMsg
.AddAttachment "<your file here>"
.attachments(1).fields("urn:schemas:mailheader:content-disposition") = "attachment; filename=""blah.pdf"""
.attachments(1).fields.update()
End With
0
 

Author Comment

by:simonm0966
ID: 20356670
I worked it around to this in JScript but your premise was fine.
// AttachFile method no longer present in CDOSYS so need to change attachments metadata 
// to ensure correct file name for attachment
var objAttachment=objMail.addAttachment (attachment, attachmentname);
objAttachment.Fields ("urn:schemas:mailheader:content-disposition").Value= 							'attachment; filename="' + attachmentname + '" ';
objAttachment.Fields.Update();

Open in new window

0
 

Author Closing Comment

by:simonm0966
ID: 31410999
I need to do extra work as I'm using JScript.  The VB references werent easy to do in JScript as I'm a relative novice at VBScript and to a lesser extent in JScript. To be fair though, I didnt say that I preferred an answer in JScript.  I could see whtat L00M was trying to achieve
0

Featured Post

ScreenConnect 6.0 Free Trial

Discover new time-saving features in one game-changing release, ScreenConnect 6.0, based on partner feedback. New features include a redesigned UI, app configurations and chat acknowledgement to improve customer engagement!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
EOF BOF error classic asp 8 48
HTML in email body has extra  tick marks 3 77
How to show result of a NULL value at random? 32 51
Button to go back 3 25
I would like to start this tip/trick by saying Thank You, to all who said that this could not be done, as it forced me to make sure that it could be accomplished. :) To start, I want to make sure everyone understands the importance of utilizing p…
I was asked about the differences between classic ASP and ASP.NET, so let me put them down here, for reference: Let's make the introductions... Classic ASP was launched by Microsoft in 1998 and dynamically generate web pages upon user interact…
Two types of users will appreciate AOMEI Backupper Pro: 1 - Those with PCIe drives (and haven't found cloning software that works on them). 2 - Those who want a fast clone of their boot drive (no re-boots needed) and it can clone your drive wh…
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…

777 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question