Edit

SendSMTPMail (recipients, attachmentPath, subject, message, attachmentFileName)

A script handler that takes over the job of sending SMTP mail.

When MoneyWorks has an email + attachment to send and the preferences are set to send via SMTP, MoneyWorks calls the Built_In:__SendSMTPMail script to send the email. This is an open-source MWScript that uses the CURL library to cummunicate with the SMTP server to get the mail delivered.

In v8.1.7 and later, if there is a script handler named SendSMTPMail, then that handler will be called instead (note: if there are multiple such handlers, they will all be called, potentially resulting in the message being sent multiple times)

recipients may be a single recipient or a comma-delimited list

attachmentPath is the posix or windows path to the file to be attached

subject is the email subject

message is the plain text message; may be blank

attachmentFileName is a suggested attachment name which may differ from the actual filename of the attachmentPath (e.g. "Invoice 1234.pdf")

Your SendSMTPMail handler can call internal handlers Built_In:__SendSMTPMail(to, path, subject, message_text, attachmentName) or Built_In:__SendSMTPMail_WithCredentials(to, path, subject, message_text, attachmentName, server, replyTo, authUser, authPass) to do the heavy lifting for you. Note that these handlers are open source and can be found in the Preload_Built_In.mwscript file in the Standard Plugins Scripts/Autoload folder.

Note that prior to v9, if there was no user defined handler, an external executable (sendEmail) was used. SendEmail(.exe) is no longer installed with MoneyWorks 9, so if you have scripts that rely on it, you may need to update them.

Automatically called:  When a message needs to be sent via SMTP

Use for:  Customising SMTP sending behaviour

Availability:  MoneyWorks Gold 8.1.7 and later.