API/Mail commands

From DreamHost
Jump to: navigation, search
Note2 icon.png Note: The following documentation is officially supported by DreamHost. However, if you find any instructions in this article do not function as intended, it's possible it may be out of date. When in doubt, please contact support for further assistance.

Mail commands

The mail API module allows management of email filters.

Commands

mail-list_filters

Dump a list of all email filter rules for all users on all accounts you have access to.

Command mail-list_filters
Values

(none)

Result

success
account_id address rank filter filter_on action action_value contains stop
1 win@example.com 0 [list] subject move yes yes
1 win@example.com 1 spammer from delete yes yes
1 win@example.com 2 blah subject delete yes yes

Possible errors

(none)

mail-add_filter

Adds a new mail filter to an email address you have with DreamHost.

Command mail-add_filter
Values

address : The full email address to which you want to add the filter
filter_on : subject, from, to, cc, body, reply-to, headers
filter : What to filter for (case sensitive)
action : move,forward,delete,add_subject,forward_shell, and, or
action_value : The parameter for the action (Note: Optional if action is delete, and, or)
contains : yes or no (optional, default is yes)
stop : yes or no (optional, default is yes. Note: Must be yes if action is delete)
rank : The rank of the filter, indexes from 0. Lower means executed first (optional, default is the number of filters for the address) To create a complex multi-part filter, simply append an underscore to each of the above, followed by a number (starting at 1) for which step of the filter it is

Result

success
filter_added

Possible errors

no_address
invalid_address
no_filter_on
invalid_filter_on
no_filter_on_#
invalid_filter_on_#
no_filter
invalid_filter
no_filter_#
invalid_filter_#
no_action
invalid_action
no_action_#
invalid_action_#
inconsistent_boolean
no_action_value
no_action_value_#
invalid_stop
invalid_stop_#
inconsistent_stop
invalid_contains
invalid_contains_#
negative_rank
negative_rank_#
rank_too_high
inconsistent_rank
cannot_create_simple_and_complex_filter
incomplete_filter
invalid_folder
invalid_forward_address
invalid_shell_account

mail-remove_filter

Remove a mail filter from an email address you have with DreamHost.

Command mail-remove_filter
Values

address : The full email address from which you want to remove the filter
filter_on : subject, from, to, cc, body, reply-to, headers
filter: What to filter for (case sensitive)
action : move,forward,delete,add_subject,forward_shell
action_value : The parameter for the action (Note: Optional if action is delete)
contains : yes or no
stop : yes or no
rank : The rank of the filter. Lower means executed first

Result

success
filter_removed

Possible errors

no_address
invalid_address
no_filter_on
invalid_filter_on
no_filter
invalid_filter
no_action
invalid_action
no_action_value
no_stop
invalid_stop
no_contains
invalid_contains
no_rank
rank_too_low
cannot_remove_subfilter
invalid_folder
invalid_forward_address
invalid_shell_account
no_such_filter
annot_remove_subfilter