Sending custom emails from cylc workflow

Currently I have a task near the end of my workflow that sends an email with a link to the output of the workflow (which is a webpage). However I’ve found that the way I’m doing it (a python script) is not very portable between sites.

Cylc already has the infrastricture to send emails for its task failure notifications. Is it possible to tap into this infrastructure to send custom content in an email?

I’ve looked at message triggers and the email event handler, and while they provide a good way to send emails, they don’t seem to provide any way to put custom content in the message body.

After a bit of a look at what is possible I have to conclude that you can’t easily do this for a specific task.

What you can do is set it in [scheduler][mail][footer] and then turn on [runtime][<namespace>]mail events = succeeded.

1 Like

I actually thought Cylc event emails were supposed to include the associated task message, if there is one. But that appears not to be the case. Some investigation required … not sure if we deliberately or accidentally dropped that somewhere along the way.

[Update] Task messages are available to event handlers in general, but they are ignored by the built-in mail event handler. We should be able to fix that …

That sounds ideal. For now I am relying on directly using the mail command, which I think cylc itself uses. It would be nicer to hook more directly into the capabilities of cylc however.

Yep, in the meantime you can roll your own event handler script, which takes the task message and sends the email itself (which it sounds as if you have done already!).

1 Like