Fortinet white logo
Fortinet white logo

CLI Reference

policy access-control delivery

policy access-control delivery

Use this command to configure delivery policies that apply to SMTP sessions being initiated by the FortiMail unit in order to deliver email.

Delivery policies can be used to encrypt each connection with TLS, and/or to encrypt each email with secure MIME (S/MIME) (also called IBE).

When the FortiMail unit initiates an SMTP session, each delivery policy is compared to the domain name in the recipient email address (RCPT TO:) and sender email addresses (MAIL FROM:) in the SMTP envelope. Policies are evaluated for a match in order, from top to bottom of the list. If a match does not exist, then the email is delivered. If a match does exist, then the connection attributes are compared to the TLS profile. Depending on the result, either the email is delivered (with encryption profile settings, if selected, and to the specified destination IP address) or the connection is not allowed. No subsequent delivery policies are applied. Only one delivery policy is ever applied to each SMTP session.

If you apply S/MIME encryption, the destination can be any email gateway or server, if either the:

  • destination’s MTA or mail server
  • recipient’s MUA

supports S/MIME and has the sender’s certificate and public key, which is necessary to decrypt the email. Otherwise, the recipient cannot read the email.

Syntax

config policy access-control delivery

edit <policy_name>

set status {enable | disable}

[set comment "<comment_str>"]

set destination-ip-type {ip-group | ip-mask}

set destination <destination_ipv4/mask>

set destination-ip-group <group_name>

set encryption-profile <profile_name>

set ip-pool-profile <profile_name>

set recipient-pattern-type {default | group | ldap | regexp}

set recipient-pattern-group <group_name>

set recipient-pattern-ldap-groupname <group_str>

set recipient-pattern-ldap-profile <profile_name>

set recipient-pattern <recipient_pattern>

set sender-pattern-type {default | group | ldap | regexp}

set sender-pattern-group <group_name>

set sender-pattern-ldap-groupname <group_str>

set sender-pattern-ldap-profile <profile_name>

set sender-pattern <sender_pattern>

set tls-profile <profile_name>

end

Variable

Description

Default

<policy_name>

Enter the number that identifies the policy.

Note: The policy identifier number may be different from the order of evaluation. FortiMail units evaluate these policies in sequential order, starting at the top of the list. Only the first matching policy is applied.

For example, if you enter:

move 15 before 1

then policy 15 is evaluated for a match before policy 1.

To show the order of evaluation for the list of policies, enter:

config policy access-control delivery

get

comment "<comment_str>"

Enter a description or comment. If a comment exists, it is displayed as a tool tip when you mouse-over the ID column in the list of policies in the GUI.

destination <destination_ipv4/mask>

Enter an IP address and netmask.

For example, enter 10.10.10.10/24 to match a 24-bit subnet, or all addresses starting with 10.10.10. This will appear as 10.10.10.0/24 in the policy list, where the 0 at the end indicates that any value matches in that position.

Similarly, 10.10.10.10/32 will appear as 10.10.10.10/32 and match only the 10.10.10.10 address.

To match any address, enter 0.0.0.0/0.

This setting is available only if destination-ip-type {ip-group | ip-mask} is ip-mask.

0.0.0.0/0

destination-ip-group <group_name>

Enter an IP address group.

This setting is available only if destination-ip-type {ip-group | ip-mask} is ip-group.

destination-ip-type {ip-group | ip-mask}

If you configured tls-profile <profile_name>, then select how you will define the destination IP addresses and netmasks that match the policy, either:

ip-mask

encryption-profile <profile_name>

If you want to apply S/MIME or IBE encryption to the email, select a profile.

Note: If you select IBE in profile content-action but S/MIME in encryption-profile <profile_name>, then IBE is overridden and not used. destination <destination_ipv4/mask> does not affect whether to apply the encryption profile.

ip-pool-profile <profile_name>

Enter an IP pool profile that FortiMail will use as its source IP address when it delivers email.

recipient-pattern <recipient_pattern>

Enter an email address or pattern. Formatting is the same as sender-pattern <sender_pattern>.

This setting is available only if recipient-pattern-type {default | group | ldap | regexp} is default or regexp.

*

recipient-pattern-group <group_name>

Enter the group of recipient email addresses.

This setting is available only if recipient-pattern-type {default | group | ldap | regexp} is group.

recipient-pattern-ldap-groupname <group_str>

Enter the group of recipient email addresses that is in the directory server.

This setting is available only if recipient-pattern-type {default | group | ldap | regexp} is ldap.

Note: Use $m in the LDAP query string to match recipient email addresses.

recipient-pattern-ldap-profile <profile_name>

Enter an LDAP profile.

This setting is available only if recipient-pattern-type {default | group | ldap | regexp} is ldap.

recipient-pattern-type {default | group | ldap | regexp}

Select how you will define the recipient email addresses that match the policy.

Options are the same as sender-pattern-type {default | group | ldap | regexp}.

default

sender-pattern <sender_pattern>

Depending on your selection in sender-pattern-type {default | group | ldap | regexp}:

  • For default: Enter a complete or partial email address. Wild card characters can be used to match multiple email addresses. An asterisk (*) represents one or more characters. A question mark (?) represents any single character. For example:

    *@example.???

    matches all email addresses at example.com, example.net, example.org, or any other “example" domain ending with a three‑letter top-level domain name.

  • For regexp: Enter a regular expression.

    Tip: To validate syntax and correct matching, you can use the validator in the FortiMail GUI. For details, see the FortiMail Administration Guide.

This setting is available only if sender-pattern-type {default | group | ldap | regexp} is default or regexp.

*

sender-pattern-group <group_name>

Enter the group of recipient email addresses.

This setting is available only if sender-pattern-type {default | group | ldap | regexp} is group.

sender-pattern-ldap-groupname <group_str>

Enter the group of recipient email addresses that is in the directory server.

This setting is available only if sender-pattern-type {default | group | ldap | regexp} is ldap.

Note: Use $m in the LDAP query string to match sender email addresses.

sender-pattern-ldap-profile <profile_name>

Enter an LDAP profile.

This setting is available only if sender-pattern-type {default | group | ldap | regexp} is ldap.

sender-pattern-type {default | group | ldap | regexp}

Select how you will define the sender email addresses that match the policy, either:

default

status {enable | disable}

Enable or disable this policy.

disable

tls-profile <profile_name>

If you want to allow or reject the connection based on whether the TLS profile matches the session, select a profile.

Related topics

cloud-api profile antivirus

policy delivery-control

policy recipient

profile encryption

profile geoip-group

profile ldap

profile tls

policy access-control delivery

policy access-control delivery

Use this command to configure delivery policies that apply to SMTP sessions being initiated by the FortiMail unit in order to deliver email.

Delivery policies can be used to encrypt each connection with TLS, and/or to encrypt each email with secure MIME (S/MIME) (also called IBE).

When the FortiMail unit initiates an SMTP session, each delivery policy is compared to the domain name in the recipient email address (RCPT TO:) and sender email addresses (MAIL FROM:) in the SMTP envelope. Policies are evaluated for a match in order, from top to bottom of the list. If a match does not exist, then the email is delivered. If a match does exist, then the connection attributes are compared to the TLS profile. Depending on the result, either the email is delivered (with encryption profile settings, if selected, and to the specified destination IP address) or the connection is not allowed. No subsequent delivery policies are applied. Only one delivery policy is ever applied to each SMTP session.

If you apply S/MIME encryption, the destination can be any email gateway or server, if either the:

  • destination’s MTA or mail server
  • recipient’s MUA

supports S/MIME and has the sender’s certificate and public key, which is necessary to decrypt the email. Otherwise, the recipient cannot read the email.

Syntax

config policy access-control delivery

edit <policy_name>

set status {enable | disable}

[set comment "<comment_str>"]

set destination-ip-type {ip-group | ip-mask}

set destination <destination_ipv4/mask>

set destination-ip-group <group_name>

set encryption-profile <profile_name>

set ip-pool-profile <profile_name>

set recipient-pattern-type {default | group | ldap | regexp}

set recipient-pattern-group <group_name>

set recipient-pattern-ldap-groupname <group_str>

set recipient-pattern-ldap-profile <profile_name>

set recipient-pattern <recipient_pattern>

set sender-pattern-type {default | group | ldap | regexp}

set sender-pattern-group <group_name>

set sender-pattern-ldap-groupname <group_str>

set sender-pattern-ldap-profile <profile_name>

set sender-pattern <sender_pattern>

set tls-profile <profile_name>

end

Variable

Description

Default

<policy_name>

Enter the number that identifies the policy.

Note: The policy identifier number may be different from the order of evaluation. FortiMail units evaluate these policies in sequential order, starting at the top of the list. Only the first matching policy is applied.

For example, if you enter:

move 15 before 1

then policy 15 is evaluated for a match before policy 1.

To show the order of evaluation for the list of policies, enter:

config policy access-control delivery

get

comment "<comment_str>"

Enter a description or comment. If a comment exists, it is displayed as a tool tip when you mouse-over the ID column in the list of policies in the GUI.

destination <destination_ipv4/mask>

Enter an IP address and netmask.

For example, enter 10.10.10.10/24 to match a 24-bit subnet, or all addresses starting with 10.10.10. This will appear as 10.10.10.0/24 in the policy list, where the 0 at the end indicates that any value matches in that position.

Similarly, 10.10.10.10/32 will appear as 10.10.10.10/32 and match only the 10.10.10.10 address.

To match any address, enter 0.0.0.0/0.

This setting is available only if destination-ip-type {ip-group | ip-mask} is ip-mask.

0.0.0.0/0

destination-ip-group <group_name>

Enter an IP address group.

This setting is available only if destination-ip-type {ip-group | ip-mask} is ip-group.

destination-ip-type {ip-group | ip-mask}

If you configured tls-profile <profile_name>, then select how you will define the destination IP addresses and netmasks that match the policy, either:

ip-mask

encryption-profile <profile_name>

If you want to apply S/MIME or IBE encryption to the email, select a profile.

Note: If you select IBE in profile content-action but S/MIME in encryption-profile <profile_name>, then IBE is overridden and not used. destination <destination_ipv4/mask> does not affect whether to apply the encryption profile.

ip-pool-profile <profile_name>

Enter an IP pool profile that FortiMail will use as its source IP address when it delivers email.

recipient-pattern <recipient_pattern>

Enter an email address or pattern. Formatting is the same as sender-pattern <sender_pattern>.

This setting is available only if recipient-pattern-type {default | group | ldap | regexp} is default or regexp.

*

recipient-pattern-group <group_name>

Enter the group of recipient email addresses.

This setting is available only if recipient-pattern-type {default | group | ldap | regexp} is group.

recipient-pattern-ldap-groupname <group_str>

Enter the group of recipient email addresses that is in the directory server.

This setting is available only if recipient-pattern-type {default | group | ldap | regexp} is ldap.

Note: Use $m in the LDAP query string to match recipient email addresses.

recipient-pattern-ldap-profile <profile_name>

Enter an LDAP profile.

This setting is available only if recipient-pattern-type {default | group | ldap | regexp} is ldap.

recipient-pattern-type {default | group | ldap | regexp}

Select how you will define the recipient email addresses that match the policy.

Options are the same as sender-pattern-type {default | group | ldap | regexp}.

default

sender-pattern <sender_pattern>

Depending on your selection in sender-pattern-type {default | group | ldap | regexp}:

  • For default: Enter a complete or partial email address. Wild card characters can be used to match multiple email addresses. An asterisk (*) represents one or more characters. A question mark (?) represents any single character. For example:

    *@example.???

    matches all email addresses at example.com, example.net, example.org, or any other “example" domain ending with a three‑letter top-level domain name.

  • For regexp: Enter a regular expression.

    Tip: To validate syntax and correct matching, you can use the validator in the FortiMail GUI. For details, see the FortiMail Administration Guide.

This setting is available only if sender-pattern-type {default | group | ldap | regexp} is default or regexp.

*

sender-pattern-group <group_name>

Enter the group of recipient email addresses.

This setting is available only if sender-pattern-type {default | group | ldap | regexp} is group.

sender-pattern-ldap-groupname <group_str>

Enter the group of recipient email addresses that is in the directory server.

This setting is available only if sender-pattern-type {default | group | ldap | regexp} is ldap.

Note: Use $m in the LDAP query string to match sender email addresses.

sender-pattern-ldap-profile <profile_name>

Enter an LDAP profile.

This setting is available only if sender-pattern-type {default | group | ldap | regexp} is ldap.

sender-pattern-type {default | group | ldap | regexp}

Select how you will define the sender email addresses that match the policy, either:

default

status {enable | disable}

Enable or disable this policy.

disable

tls-profile <profile_name>

If you want to allow or reject the connection based on whether the TLS profile matches the session, select a profile.

Related topics

cloud-api profile antivirus

policy delivery-control

policy recipient

profile encryption

profile geoip-group

profile ldap

profile tls