pem.cqmail.addMailForwarding

This method is supported by Operations starting from version 2.5.

This method associates a forwarding e-mail address with a Mailname. There are the following use cases:

  • Create a new Mailname and associate a forwarding e-mail address with it. In this case Operations creates a Mailname and associates a forwarding e-mail address with it.

    Notes:

    1. A Mailname password is required to create a Mailname, thus the password and password_crypted parameters are mandatory.

    2. Use the pem.cqmail.editMailname method to change the password of an existing Mailname.

  • Associate a forwarding e-mail address with an existing Mailname. In this case Operations associates a forwarding e-mail address with an existing Mailname.

    Notes:

    1. The password of an existing Mailname is used, thus the password and password_crypted parameters are optional. These parameters are ignored, if they are specified.

    2. Use the pem.cqmail.editMailname method to change the password of an existing Mailname.

Additionally, if a new Mailname is created, Operations creates a Service User with the following properties:

  • Display Name – Local part (e-mail address before the @ sign) of a Mailname is assigned.
  • Login – Mailname is assigned. If an "All-Domains" Mailname is created, Operations generates the Service User Login in the <Local part of mailname>@sub<Subscription ID>.local form.
  • Password – Mailname password is assigned.

The E-mail Service is assigned to the Service User.

The method has the following input parameters:

Name

Type

Short Description

subscription_id

int

ID of a Subscription containing the E-mail service. The following use-cases are available:

  • The Subscription contains services in the subscription-local mode. The new Mailname and Service User are created. You must specify the identifier of the Subscription. The subscription-local E-Mail service from the Subscription will be used to create the Mailname, Service User, and forwarding e-mail address. The Service User will be bound to the Subscription.
  • The Subscription contains services in the account-wide mode. The new Mailname and Service User are created. You must specify the identifier of the Subscription. The account-wide E-Mail service from the Subscription will be used to create the Mailname, Service User, and forwarding e-mail address.
  • The Subscription contains services in the subscription-local mode. The existing Mailname and Service User are used to create the forwarding e-mail address. The Service User has been bound to the Subscription. You must specify the identifier of the Subscription. The subscription-local E-Mail service from the Subscription will be used to create the forwarding e-mail address for the Mailname and Service User.
  • The Subscription contains services in the subscription-local mode. The existing Mailname and Service User are used to create the forwarding e-mail address. The Service User has not been bound to any Subscription. The Service User does not have any services assigned. You must specify the identifier of the Subscription. The subscription-local E-Mail service from the Subscription will be used to create the forwarding e-mail address for the Mailname and Service User. The Service User will be bound to the Subscription.
  • The Subscription contains services in the account-wide mode. The existing Mailname and Service User are used to create the forwarding e-mail address. The Service User has not been bound to any Subscription. The Service User does not have any services assigned. You must specify the identifier of the Subscription. The account-wide E-Mail service from the Subscription will be used to create the forwarding e-mail address for the Mailname and Service User.
  • The Subscription contains services in the account-wide mode. The existing Mailname and Service User are used to create the forwarding e-mail address. The Service User has not been bound to any Subscription. The Service User has services from Subscriptions with services in the account-wide mode. You must specify the identifier of the Subscription. The account-wide E-Mail service from the Subscription will be used to create the forwarding e-mail address for the Mailname and Service User.

name

string

Local part (e-mail address before the @ sign).

[domain_name]

string

Name of the Domain to create a Mailname for. There are the following use cases:

  • This parameter is omitted. In this case Operations creates an "All-Domains" Mailname. For example: name@<all-domains>.
  • This parameter is specified. In this case Operations creates a Mailname for a Domain specified. For example: name@domain.com.

If the domain_name parameter is specified, the method checks that the following requirements are satisfied:

  • CQMail hosting service is added to the Domain.
  • CQMail hosting service corresponds to the Subscription specified.

The method returns an error, if one of the requirements is not satisfied.

forward_to

string

E-mail address to forward mail to.

[password]

string

Mailname password.

[password_crypted]

boolean

Whether the password is passed in the encrypted form (BSD MD5). There are the following possible values:

  • 0 – password is passed in the plain text form.
  • 1 – password is passed in the encrypted form.

The method has no output parameters.

Note: Starting from Operations 2.6.4 this method can also be called under Reseller permissions.