salt.modules.win_smtp_server module

Module for managing IIS SMTP server configuration on Windows servers. The Windows features 'SMTP-Server' and 'Web-WMI' must be installed.

depends

wmi

salt.modules.win_smtp_server.get_connection_ip_list(as_wmi_format=False, server='SmtpSvc/1')

Get the IPGrant list for the SMTP virtual server.

Parameters
  • as_wmi_format (bool) -- Returns the connection IPs as a list in the format WMI expects.

  • server (str) -- The SMTP server name.

Returns

A dictionary of the IP and subnet pairs.

Return type

dict

CLI Example:

salt '*' win_smtp_server.get_connection_ip_list
salt.modules.win_smtp_server.get_log_format(server='SmtpSvc/1')

Get the active log format for the SMTP virtual server.

Parameters

server (str) -- The SMTP server name.

Returns

A string of the log format name.

Return type

str

CLI Example:

salt '*' win_smtp_server.get_log_format
salt.modules.win_smtp_server.get_log_format_types()

Get all available log format names and ids.

Returns

A dictionary of the log format names and ids.

Return type

dict

CLI Example:

salt '*' win_smtp_server.get_log_format_types
salt.modules.win_smtp_server.get_relay_ip_list(server='SmtpSvc/1')

Get the RelayIpList list for the SMTP virtual server.

Parameters

server (str) -- The SMTP server name.

Returns

A list of the relay IPs.

Return type

list

Note

A return value of None corresponds to the restrictive 'Only the list below' GUI parameter with an empty access list, and setting an empty list/tuple corresponds to the more permissive 'All except the list below' GUI parameter.

CLI Example:

salt '*' win_smtp_server.get_relay_ip_list
salt.modules.win_smtp_server.get_server_setting(settings, server='SmtpSvc/1')

Get the value of the setting for the SMTP virtual server.

Parameters
  • settings (str) -- A list of the setting names.

  • server (str) -- The SMTP server name.

Returns

A dictionary of the provided settings and their values.

Return type

dict

CLI Example:

salt '*' win_smtp_server.get_server_setting settings="['MaxRecipients']"
salt.modules.win_smtp_server.get_servers()

Get the SMTP virtual server names.

Returns

A list of the SMTP virtual servers.

Return type

list

CLI Example:

salt '*' win_smtp_server.get_servers
salt.modules.win_smtp_server.set_connection_ip_list(addresses=None, grant_by_default=False, server='SmtpSvc/1')

Set the IPGrant list for the SMTP virtual server.

Parameters
  • addresses (str) -- A dictionary of IP + subnet pairs.

  • grant_by_default (bool) -- Whether the addresses should be a blacklist or whitelist.

  • server (str) -- The SMTP server name.

Returns

A boolean representing whether the change succeeded.

Return type

bool

CLI Example:

salt '*' win_smtp_server.set_connection_ip_list addresses="{'127.0.0.1': '255.255.255.255'}"
salt.modules.win_smtp_server.set_log_format(log_format, server='SmtpSvc/1')

Set the active log format for the SMTP virtual server.

Parameters
  • log_format (str) -- The log format name.

  • server (str) -- The SMTP server name.

Returns

A boolean representing whether the change succeeded.

Return type

bool

CLI Example:

salt '*' win_smtp_server.set_log_format 'Microsoft IIS Log File Format'
salt.modules.win_smtp_server.set_relay_ip_list(addresses=None, server='SmtpSvc/1')

Set the RelayIpList list for the SMTP virtual server.

Due to the unusual way that Windows stores the relay IPs, it is advisable to retrieve the existing list you wish to set from a pre-configured server.

For example, setting '127.0.0.1' as an allowed relay IP through the GUI would generate an actual relay IP list similar to the following:

['24.0.0.128', '32.0.0.128', '60.0.0.128', '68.0.0.128', '1.0.0.0', '76.0.0.0',
 '0.0.0.0', '0.0.0.0', '1.0.0.0', '1.0.0.0', '2.0.0.0', '2.0.0.0', '4.0.0.0',
 '0.0.0.0', '76.0.0.128', '0.0.0.0', '0.0.0.0', '0.0.0.0', '0.0.0.0',
 '255.255.255.255', '127.0.0.1']

Note

Setting the list to None corresponds to the restrictive 'Only the list below' GUI parameter with an empty access list configured, and setting an empty list/tuple corresponds to the more permissive 'All except the list below' GUI parameter.

Parameters
  • addresses (str) -- A list of the relay IPs. The order of the list is important.

  • server (str) -- The SMTP server name.

Returns

A boolean representing whether the change succeeded.

Return type

bool

CLI Example:

salt '*' win_smtp_server.set_relay_ip_list addresses="['192.168.1.1', '172.16.1.1']"
salt.modules.win_smtp_server.set_server_setting(settings, server='SmtpSvc/1')

Set the value of the setting for the SMTP virtual server.

Note

The setting names are case-sensitive.

Parameters
  • settings (str) -- A dictionary of the setting names and their values.

  • server (str) -- The SMTP server name.

Returns

A boolean representing whether all changes succeeded.

Return type

bool

CLI Example:

salt '*' win_smtp_server.set_server_setting settings="{'MaxRecipients': '500'}"