Attachments and how to email them

Options

Hi,

 

I have a problem with email attachments.

 

My application allows me to choose the filepath of the file I wish to attach to my email  e.g. //servera/foldera/file.txt

 

I then use Mstm.SendMail to email the user, with the filepath assigned to parameter 6 (attachment).

 

More often or not, the email fails with a security access error message.  I'm guessing this is because although the User has access to choose which file to attach, the ID which sends the email out does not have access to the server/path.

 

A possible solution could be to store the file in Metastorm tables as an attachment and then link to this as the attachment to send.

 

However, despite some digging (I'm new to Metastorm), I'm unsure how to code this.

 

Could anyone give me an example of:

a) given you have the pathname of the file you wish to attach, what is the correct way to save this file as an attachment to the Metastorm tables?

b) the correct notation to then locate and pass this saved attachement file to a user via email?

 

I should add that I'm using Metastorm 9.2.

 

Any help or advice much appreciated! :-)

 

 

Tagged:

Comments

  • Actually, the file needs to be accessible as a file to the engine and account which runs the engine.

    We have solutions which ReadAttachment from the internal file attachment, when applicable, or pull from our DMS ... but both the the file on a local (to the engine) drive directory.  We then use the local file(s) to add the email without issue.  Ideally the local files would be removed after the email is sent, but we've implemented a directory sweep process as a back up.

     

    I presume as long as your service account has access to the remote file, it may work.  I cannot say for sure though.

  • For file permission issues like this I can't suggest ProcMon enough:

    http://technet.microsoft.com/en-us/sysinternals/bb896645.aspx

     

    Windows can do some very weird things with file permissions, especially with UAC now, and scoping ProcMon down to the filepath of the file you are trying to attach should tell you which process and which windows user is failing to access it.

     

    But in general, Brian is correct and the engine account should be the one who needs access. But group policy and UAC can make things that should work fail in certain environments and ProcMon should show you exactly what needs what.

  • Thanks for the advice.  Currently, we store attachments in Office Warehouse, but again it may be difficult to the engine account access these files.  I'm looking at the idea of temporarily storing the attachment file somewhere before deleting it after the email processing has occurred, but this may contravene our company security standards.