Welcome Serena Central users! CLICK HERE
The migration of the Serena Central community is currently underway. Be sure to read THIS MESSAGE to get your new login set up to access your account.
prolinkdata_gr Trusted Contributor.
Trusted Contributor.
2757 views

CDO attachment problem

Hi all,

I am using the CDO library in order to create and send a mail with an attachment. After mail is sent, program deletes or moves the attachment file to another folder. My program works well (message is sent) except the following:

wrun32.exe keeps the attachment file locked and the program can't delete it or move it to another folder.

Although I am doing all the necessary DESTROY statements, the attachment file is actualy deleted or moved only when wrun32.exe terminates.

Is there any other way for creating and sending e-mail messages (except using an outlook object) ?

Thanks

 

0 Likes
6 Replies
Micro Focus Expert
Micro Focus Expert

RE: CDO attachment problem

I got these responses on a google query ... stackoverflow.com/.../unlock-file-after-sending-as-attachement-with-cdo ... and  ...weblog.west-wind.com/.../SmtpClient-and-Locked-File-Attachments .. this second one recommends calling the Dispose function to unlock the file. I hope one of these helps.

0 Likes
Knowledge Partner
Knowledge Partner

RE: CDO attachment problem

"Is there any other way for creating and sending e-mail messages (except using an outlook object) ?"

Here is another way to use CDO as a VBScript (which you call with CALL SYSTEM):

http://community.microfocus.com/microfocus/cobol/extend_and_acucobol/f/20/t/11213.aspx


Tom Morrison
Consultant

0 Likes
kenthudson Absent Member.
Absent Member.

RE: CDO attachment problem

If you don't mind calling a Python script, it's relatively easy to send an email with an attachment without using the Outlook object.

0 Likes
prolinkdata_gr Trusted Contributor.
Trusted Contributor.

RE: CDO attachment problem

Thank you all for your answers...

@shjerpe

I am aware of these articles but I can't find a dispose() definition in the CDO def file... I suppose DESTROY should do the same job as dispose()...

@Tom Morison and  kenthudson

Ok, I will give them a look

0 Likes
neidingd Honored Contributor.
Honored Contributor.

RE: CDO attachment problem

we use blat for sending emails with Cobol.

http://www.blat.net/

0 Likes
prolinkdata_gr Trusted Contributor.
Trusted Contributor.

RE: CDO attachment problem

Great! Simple and easy, it worked like a charm. Thank you neidingd

0 Likes
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.