Mailfromd |
|
General-Purpose Mail Filter |
Sergey Poznyakoff |
Mailfromd Manual (split by node): | ? |
Returns the domain part of str, if it is a valid email address, otherwise returns str itself.
domainpart("gray") ⇒ "gray" domainpart("gray@gnu.org.ua") ⇒ "gnu.org.ua" |
Returns the index of the first occurrence of the string t in the string s, or -1 if t is not present.
index("string of rings", "ring") ⇒ 2 |
Optional argument start, if supplied, indicates the position in string where to start searching.
index("string of rings", "ring", 3) ⇒ 10 |
To find the last occurrence of a substring, use the function rindex (see rindex).
Converts str, which should be a valid time interval specification (see time interval specification), to seconds.
Returns the length of the string str in bytes.
length("string") ⇒ 6 |
Returns the local part of str if it is a valid email address, otherwise returns str unchanged.
localpart("gray") ⇒ "gray" localpart("gray@gnu.org.ua") ⇒ "gray" |
Replicate a string, i.e. return a string, consisting of s repeated n times:
replstr("12", 3) ⇒ "121212" |
Returns the string composed of the characters from s in reversed order:
revstr("foobar") ⇒ "raboof" |
Returns the index of the last occurrence of the string t in the string s, or -1 if t is not present.
rindex("string of rings", "ring") ⇒ 10 |
Optional argument start, if supplied, indicates the position in string where to start searching. E.g.:
rindex("string of rings", "ring", 10) ⇒ 2 |
See also String manipulation.
Returns the at most length-character substring of str starting at start. If length is omitted, the rest of str is used.
If length is greater than the actual length of the string, the
e_range
exception is signalled.
substr("mailfrom", 4) ⇒ "from" substr("mailfrom", 4, 2) ⇒ "fr" |
Returns a substring of str between offsets start and
end, inclusive. Negative end means offset from the end of
the string. In other words, yo obtain a substring from start to the
end of the string, use substring(str, start, -1)
:
substring("mailfrom", 0, 3) ⇒ "mail" substring("mailfrom", 2, 5) ⇒ "ilfr" substring("mailfrom", 4, -1) ⇒ "from" substring("mailfrom", 4, length("mailfrom") - 1) ⇒ "from" substring("mailfrom", 4, -2) ⇒ "fro" |
This function signals e_range
exception if either start or
end are outside the string length.
Returns a copy of the string str, with all the upper-case characters translated to their corresponding lower-case counterparts. Non-alphabetic characters are left unchanged.
tolower("MAIL") ⇒ "mail" |
Returns a copy of the string str, with all the lower-case characters translated to their corresponding upper-case counterparts. Non-alphabetic characters are left unchanged.
toupper("mail") ⇒ "MAIL" |
Format code as a floating-point number with prec decimal digits:
sa_format_score(5000, 3) ⇒ "5.000" |
This function is convenient for formatting SpamAssassin scores for use in message headers and textual reports. It is defined in module ‘sa.mf’.
See SpamAssassin, for examples of its use.
Format a SpamAssassin report text in order to include it in a RFC 822 header. This function selects the score listing from %text, and prefixes each line with ‘* ’. Its result looks like:
* 0.2 NO_REAL_NAME From: does not include a real name * 0.1 HTML_MESSAGE BODY: HTML included in message |
See SpamAssassin, for examples of its use.
Returns at most n last components of the domain name domain.
If n is 0 the function is equivalent to domainpart
.
This function is defined in ‘strip_domain_part.mf’ module (see section Modules).
Examples:
require strip_domain_part strip_domain_part("puszcza.gnu.org.ua", 2) ⇒ "org.ua" strip_domain_part("puszcza.gnu.org.ua", 0) ⇒ "gnu.org.ua" |
Returns ‘true’ if str is a valid IPv4 address. This function is defined in ‘is_ip.mf’ module (see section Modules).
For example:
require is_ip is_ip("1.2.3.4") ⇒ 1 is_ip("1.2.3.x") ⇒ 0 is_ip("blah") ⇒ 0 is_ip("255.255.255.255") ⇒ 1 is_ip("0.0.0.0") ⇒ 1 |
Reverses octets in ip, which must be a valid string representation of an IPv4 address.
Example:
revip("127.0.0.1") ⇒ "1.0.0.127"
If email is a valid VERP-style email address for domain, this function returns the user name, corresponding to that email. Otherwise, it returns empty string.
verp_extract_user("gray=gnu.org.ua@tuhs.org", 'gnu\..*') ⇒ "gray" |
Mailfromd Manual (split by node): | ? |
Verbatim copying and distribution of this entire article is permitted in any medium, provided this notice is preserved.