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 managing email filters.

Commands

mail-list_filters

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

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 us.

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 us.

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
cannot_remove_subfilter