Common Macros

From ESM Wiki
Revision as of 08:09, 10 October 2009 by 194.79.22.6 (Talk)

Jump to: navigation, search

The following macros can be used in templates and conditions of all engines:

$attachment
$attachment.base64
$attachment.headers
$attachment.text
$attachment.malformed
$attachment.multipart
$attachment.resource_fork
$attachment.resource_fork.base64
$attachment.file_name
$attachment.mime_type
$body
$body.html
$body_part
$body_part.is_body
$body_part.is_attachment
$body_part.size
$body_part.headers
$body_part.text
$body_part.malformed
$body_part.multipart
$body_part.file_name
$body_part.digest
$body_part.resource_fork

$body_part.resource_fork.size
$body_part.resource_fork.digest
$data
$data.size
$data.digest
$decode_base64
$empty
$encode_base64
$json_escape
$headers
$headers.message_id
$headers.in_reply_to
$headers.references
$headers.from
$headers.sender
$headers.reply_to
$headers.to
$headers.cc
$headers.bcc
$headers.subject
$hmac
$host
$ip

$ip.dec
$ip.hex
$if_not_empty
$gethostname
$group
$message_id
$md5
$not_empty
$pid
$recipient
$recipient.local
$recipient.domain
$recipient.component
$sender
$sender.local
$sender.domain
$sender.component
$sha1
$size
$size_hex
$sp, $br, $cr, $lf, $crlf, $htab
$subject
$text_find_replace_all

$thread
$time
$time6
$uri_escape
$wrap
$xml_cdata
$xml_escape
$year, $month, $day, $hour, $minute, $second

$attachment

Description: Email attachment data. Attachment is every body part that is not body in body-attachments-view typical for MUA's.
Dimension: $attachment
Stage: smtp-end-of-data

$attachment.base64

Description: Email attachment data encoded as base64. Using this macro may be more effective then using ${encode_base64 $attachment} in most cases because attachment data in email is likely to be already encoded as base64.
Dimension: $attachment
Stage: smtp-end-of-data

$attachment.headers

Description: Email attachment headers as single string.
Dimension: $attachment
Stage: smtp-end-of-data

$attachment.text

Description: Text extracted from email attachment and converted to utf-8 encoding. This macro is intended to extract pure text from different types of documents for this text to be used in content analyzing tools. Though currently this macro is fully equivalent to $attachment it will be enhanced to support as much types of documents as possible.
Dimension: $attachment
Stage: smtp-end-of-data

$attachment.malformed

Description: Flag that indicates whether attachment is malformed from MIME point of view. It has two values: "yes" and "no". When attachment is malformed its data will be empty. One should use this flag to exclude malformed attachments from processing to avoid lost of data in scenarios like attachment stripping. For example:
<engines>
  <file>
    <save>
      <precondition>$attachment.malformed $EQ no</precondition>
      ...
    </save>
  </file>
</engines>
Dimension: $attachment
Stage: smtp-end-of-data

$attachment.multipart

Description: Flag that indicates whether attachment is a legacy Apple file that consists from data and resource forks. It has two values: "yes" and "no". When attachment is multipart its $attachment.resource_fork may be not empty. One should use this flag to exclude multipart attachments from processing to avoid lost of data in scenarios like attachment stripping. For example (in combination with malformed flag):
<engines>
  <file>
    <save>
      <precondition>$attachment.malformed $EQ no $AND $attachment.multipart $EQ no</precondition>
      ...
    </save>
  </file>
</engines>

However it is expected that such file format is depricated thus will rarely appear in emails.

Dimension: $attachment
Stage: smtp-end-of-data

$attachment.resource_fork

Description: Resource fork of legacy Apple file that consists from data and resource forks. It is expected that such file format is depricated thus will rarely appear in emails.
Dimension: $attachment
Stage: smtp-end-of-data

$attachment.resource_fork.base64

Description: Base64 encoded resource fork of legacy Apple file that consists from data and resource forks. Using this macro may be more effective then using ${encode_base64 $attachment.resource_fork} in most cases because attachment data in email is likely to be already encoded as base64. It is expected that such file format is depricated thus will rarely appear in emails.
Dimension: $attachment
Stage: smtp-end-of-data

$attachment.file_name

Description: File name of an attachment as extracted from headers and converted to utf-8. Will be empty if no file name is specified in headers.
Dimension: $attachment
Stage: smtp-end-of-data

$attachment.mime_type

Description: MIME type of an attachment as extracted from headers. Will be empty if no MIME type is specified in headers.
Dimension: $attachment
Stage: smtp-end-of-data

$body

Description: Email body in body-attachment-view typical for MUA's. Body is the first text body part in email or text body part in first alternative.
Stage: smtp-end-of-data

$body.html

Description: Html alternative of email body in body-attachment-view typical for MUA's. Html body is the first html body part in email or html body part in first alternative.
Stage: smtp-end-of-data

$body_part

Description: Body part of a email in body-part-view. Unlike a body-attachments-view body-part-view doesn't distinguish between body and attachments. It treats all body part in the same manner. This is more closely corresponds to MIME standard because it doesn't distinguish body and attachments - all are body parts.
Dimension: $body_part
Stage: smtp-end-of-data

$body_part.is_body

$body_part.is_attachment

$body_part.size

$body_part.headers

$body_part.text

$body_part.malformed

$body_part.multipart

$body_part.file_name

$body_part.digest

$body_part.resource_fork

$body_part.resource_fork.size

$body_part.resource_fork.digest

$data

$data.size

$data.digest

$decode_base64

$empty

$encode_base64

$json_escape

$headers

$headers.message_id

$headers.in_reply_to

$headers.references

$headers.from

$headers.sender

$headers.reply_to

$headers.to

$headers.cc

$headers.bcc

$headers.subject

$hmac

$host

$ip

$ip.dec

$ip.hex

$if_not_empty

$gethostname

$group

$message_id

$md5

$not_empty

$pid

$recipient

$recipient.local

$recipient.domain

$recipient.component

$sender

$sender.local

$sender.domain

$sender.component

$sha1

$size

$size_hex

$sp, $br, $cr, $lf, $crlf, $htab

$subject

$text_find_replace_all

$thread

$time

$time6

$uri_escape

$wrap

$xml_cdata

$xml_escape

$year, $month, $day, $hour, $minute, $second

Personal tools