Interfacing with a mail client on Windows

By default. MoneyWorks uses SimpleMAPI to create a new email message in the system mail client (assuming the default system mail client supports SimpleMAPI).

The drawback with SimpleMAPI is that it is modal (you must send or discard each message before you can continue), and there is no signature support.

From v7.3.7, the Windows version of MoneyWorks has supported using an external script for mail client interfacing. A script for interfacing to Microsoft Outlook is built-in and used automatically, but you can also write your own script if you need to interface to another mail client that supports COM/Scripting.

MoneyWorks will look for a script named mail_client_helper.vbs in the Standard Plugins Scripts folder. If this script is found, it will be run with the following parameters: mail_client_helper.vbs "attachmentpath" "recipients" "subject" "message"

The following script will create a new email retaining your default signature. It does this by grabbing the content of the new empty email (which contains the signature) then re-adding that content after attaching the enclosure (which obliterates the signature as a side effect).

' Usage mail_client_helper "attachmentpath"  "recip1" "subject" "message"
Set outlook = createobject("Outlook.Application")
Set message = outlook.createitem(olMailItem)
With message
	.Subject = WScript.Arguments.Item(2)
	.Display
	signature = .htmlbody
	.Recipients.Add WScript.Arguments.Item(1)  ' assume only one recipient
	.Attachments.Add WScript.Arguments.Item(0)
  .htmlbody = WScript.Arguments.Item(3) & vbNewLine & signature
End With
Posted in Uncategorized | Comments Off on Interfacing with a mail client on Windows