Convert

Syntax

convert <quoted-from-media-type : string> <quoted-to-media-type : string> <transcoding-params : string-list> ;

Description

To simplify testing for supported and successful conversions, the "convert" action can also be used as a test. As such, it will attempt to perform the requested conversion(s) and will evaluate to "false" if and only if at least one conversion failed. The failure can be because a conversion was unsupported or because the data could not be converted (perhaps it had been corrupted in transit or mislabeled at its origin).

This creates a new type of Sieve action, a "testable action". The usage as a test is exactly the same as for an action, and it doubles as an action and a test of the action's result at the same time. See below for an example of how this test can be used.

Example

In the following example, all "image/tiff" body parts of the message are converted to "image/jpeg". If the conversions were successful, those messages are then filed into a mailbox called "INBOX.pics".

require ["fileinto", "convert"]; if (convert "image/tiff" "image/jpeg" ["pix-x=320","pix-y=240"]) {   fileinto "INBOX.pics"; }

Module

Convert : Requires import of the "convert" capability

Resources

RFC6558
RFC5259