SendMail changes default directory

The Amyuni PDF Converter is our Printer Driver that enables you to convert any documents to PDF format. If you have any questions about installing and using the Amyuni PDF Converter please post them here.
Post Reply
COMPUTECHMD
Posts: 5
Joined: Thu Jun 23 2011
Location: Canada

SendMail changes default directory

Post by COMPUTECHMD »

Not sure if this is a bug, but when using SendMail (ActiveX) in my application (in this case, VFP 9), I found it killed operation of my application after sending an email. Tracked this down to being caused by SendMail changing the default directory location. Simple work-around was to save current/default directory, call SendMail, restore current/default directory. This was a pain to track down, symptoms of files suddenly missing when they really weren't, etc. I don't think this is specific to VFP, so posted here - hope it helps.
Rich
Posts: 76
Joined: Thu Jun 16 2011

Re: SendMail changes default directory

Post by Rich »

The SendMail function uses the default email client that is on the end-user's system to send out the PDF file by email. We have little control on what happens within the email client (e.g. Outlook) so the default directory might be changing without the caller knowing it. An alternative would be to use the SendSMTPEmail which is fully controlled by us. For a future release we will save and restore the default directory within the SendMail function. Thank you for noting this weird behaviour.
Efficient and accurate conversion to PDF, XPS, PDF/A and more. Free trials at - http://www.amyuni.com
COMPUTECHMD
Posts: 5
Joined: Thu Jun 23 2011
Location: Canada

Re: SendMail changes default directory

Post by COMPUTECHMD »

Thanks for the info - for reference my test email client is: Microsoft Office Outlook 2007 SP2 MSO.

SMTP mail was not chosen because there is a lot of user configuration involved on the end user side (SMTP server name, port, etc) that we would have to build into our aplpication, and an issue with ensuring the email is sent from (with a current return address to) the user (i.e. having the user ensure his current email address is also always updated in a second place, or querying it from the system). There are also other complications with SMTP. SMTP/MAPI each have their advantages/disadvantages; in this one project case, MAPI was the simplest and safest.
Robert2
Posts: 1
Joined: Tue Jun 28 2011

Re: SendMail changes default directory

Post by Robert2 »

There is a new fix for this issue. The SendMail MAPI function will now save and then restore the original value of the current directory.

The Login MAPI call is unexpectedly changing this value. This fix is important for Foxpro users, for the implications and use that the default directory has.
Post Reply