Home / Subscriber / mail
Send a continues e-mail to a subscriber (Open mail cannot be used).
The following errors can occur:
- Token not present in request.
- Token not in the required format.
- Session does not exist.
- Session has expired.
- The user does not exist.
- No database specified.
- Database parameter not in correct format.
- You are not allowed to access this database.
- The mail parameter has the wrong format.
- The mail parameter is required.
- The selected mail does not exist.
- The selected mail is not fully tested.
- The subscriber parameter is required.
- The subscriber parameter is invalid.
- The selected subscriber does not exist.
- The sysname parameter is required.
- The sysname parameter has the wrong format ([a-z0-9 _@-]).
- One or more categories do not exist.
- The substitute parameter must be an array.
- The substitute %s is not a valid key, the key should always be a string.
- The substitute %s has a wrong value type (%s instead of string, double, integer or boolean).
You should call this function as followed:
- rest/v2/subscriber/mail?token=TOKEN&database=DATABASE_ID&mail=MAIL_ID&subscriber=SUBSCRIBER_ID
&sysname=STRING&categories[]=CATEGORY_ID&categories[]=CATEGORY_ID&substitute[REPLACE_NAME]=REPLACE_VALUE
&substitute[REPLACE_NAME]=REPLACE_VALUE
require_once 'Rest.php';
$username = 'my_username';
$password = 'my_password';
$database = '999';
$rest = new Rest($username, $password, $database);
$result = $rest->call('subscriber/mail', [
'mail' => 'MAIL_ID',
'subscriber' => 'SUBSCRIBER_ID',
'sysname' => 'STRING',
'categories' => [
'CATEGORY_ID',
'CATEGORY_ID'
],
'substitute' => [
'REPLACE_NAME' => 'REPLACE_VALUE',
'REPLACE_NAME' => 'REPLACE_VALUE'
]
], 'GET');
var_dump($result);
The following parameters this method can/should be called with:
key: mail
values: integer
what: The mail you want to send, see mail/availables
key: subscriber
values: integer, the ID of a subscriber
what: The subscriber you want to send to e-mail to
key: sysname
values: string [a-z0-9 _@-]
what: The name of the group, all statistics will be grouped into
key: categories
values: array[integer], not required
what: A set of categories the mail should be build with
key: substitute
values: array[string] = string, double, integer or boolean, not required
what: All the items in a mail {replace_xyz} will be replaced with this array
The following items:
- user/login For the TOKEN.
- user/database For the DATABASE_ID
- mail/availables For the MAIL_ID
- subscriber/findByEmail For the SUBSCRIBER_ID