Common Macros

From ESM Wiki
(Difference between revisions)
Jump to: navigation, search
($attachment.multipart)
($attachment.multipart)
Line 202: Line 202:
 
</engines>
 
</engines>
 
</pre>
 
</pre>
However it is expected that such file format is depricated thus such files will rarely appear in emails.
+
However it is expected that such file format is depricated thus will rarely appear in emails.
 
</td>
 
</td>
 
   </tr>
 
   </tr>

Revision as of 05:40, 10 October 2009

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

$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

Personal tools