API reference: Message management documents the function signatures, parameters, return values, and error behavior of the Elaine HTTP API.
Function availability depends on the Elaine release and enabled features. Authenticate HTTP requests with an Elaine-issued Bearer JWT.
Function overview| boolean|integer | api_addressToGroupOrSegment ( int $nl_id , int $group_id , int $segment_id , string $status = 'ready' , bool $c_id = false ) |
| Addresses a mailing to a group or target group depending on whether the $group_id or $segment_id has been included. |
| integer | api_createMailingFromTemplate ( int $template_id , string $nl_name , string $nl_title = '' , int $folder_id ) |
| Creates a mailing with the template $template_id and the name $nl_name. |
| array|integer | api_getActionmails ( string $nl_title = '' ) |
| Returns an array with all action emails. |
| integer | api_getGroupLastMailing ( int $ev_id ) |
| Returns the ID of the mailing last sent to the recipient group $ev_id. |
| string|integer | api_getMailingContent ( int $nl_id ) |
| Returns the content source code of a published mailing $nl_id. |
| array|integer | api_getMailingsByStatus ( string $status = '' ) |
| Delivers an array of all mailings, which are currently in the specified status ($status='': all). |
| array|integer | api_getMessageInfo ( string $message_name = '' , string $message_status = '' ) |
| Delivers an array of all messages, which are currently in the [optional] specified $message_status or having the [optional] specified $message_name. |
| boolean|integer | api_mailingAddressToGroup ( int $nl_id , int $group_id , string $type = 'ready' , bool $c_id = false ) |
| Addresses the mailing with the $nl_id to the group $group_id. |
| boolean|integer | api_mailingAddressToSegment ( int $nl_id , int $segment_id , string $type = 'ready' , bool $c_id = false ) |
| Addresses the mailing with the $nl_id to the target group with the $segment_id. |
| integer | api_mailingCopy ( int $nl_id , string $new_nl_name = '' , string $new_nl_title = '' , int $new_folder_id ) |
| Copies a mailing $nl_id and saves it with the name $new_nl_name. |
| integer|boolean | api_mailingDelete ( int $nl_id ) |
| Moves the specified mailing to the recycle bin. |
| boolean | api_mailingPause ( int $nl_id , bool $release = false ) |
| Pauses the sending process of the specified mailing or deactivates the pause. |
| boolean | api_mailingRelease ( int $nl_id , string $datetime = null , string $cycle = 'no' ) |
| Starts the sending of the specified mailing. |
| array|boolean | api_mailingRender ( int $elaine_id , int $mailing_id , array $userdata = array() , int $group , bool $preview = false ) |
| Returns an associative array of a mailing (keys 'header' and 'body'). |
| void | api_mailingStop ( int $nl_id ) |
| Aborts the sending of the specified mailing. |
| boolean | api_mailingTestsend ( int $nl_id , int $ev_id ) |
| Runs a test sending for the specified mailing. |
| boolean | api_mailingUnrelease ( int $mailingID ) |
| Revokes clearing of the given mailing and moves it back to the "Ready for dispatch" folder. |
| boolean|integer | api_sendSingle ( int $nl_id , int $p_id , int $ev_id , int $priority = null , int $variant_position = null , string $type = 'normal' ) |
| Sends the mailing with the ID $nl_id to the recipient with the profile ID $elaine_id with the sender data of the group $ev_id. |
| boolean|integer | api_userSendMail ( int $mailing_id , int $user_id , int $group , bool $bcc = false , bool $preview = false ) |
| Deprecated since 6. |
Functions
api_addressToGroupOrSegment
boolean|integer api_addressToGroupOrSegment( int $nl_id , int $group_id , int $segment_id , string $status = 'ready' , bool $c_id = false )
Addresses a mailing to a group or target group depending on whether the $group_id or $segment_id has been included.
Parameters
| int | $nl_id | Newsletter ID |
| int | $group_id | Group ID |
| int | $segment_id | Targetgroup ID |
| string | $status = 'ready' | Status |
| bool | $c_id = false | Campaign ID |
Return Value
| boolean|integer | Success or failure or error code |
api_createMailingFromTemplate
integer api_createMailingFromTemplate( int $template_id , string $nl_name , string $nl_title = '' , int $folder_id )
SINCE 5.11.4 Creates a mailing with the template $template_id and the name $nl_name. Optionally a code $nl_title and a save folder $folder_idcan be specified.Parameters
| int | $template_id | Template ID |
| string | $nl_name | Newsletter name |
| string | $nl_title = '' | Newsletter title |
| int | $folder_id | Folder ID |
Return Value
| integer | New newsletter ID or error code |
api_getActionmails
array|integer api_getActionmails( string $nl_title = '' )
SINCE 5.12.0 Returns an array with all action emails. Optionally, you can filter via $nl_titleaccording to the code. The array contains the following properties:'nl_id': ID'nl_name': name'nl_title': code'is_transactionmail': transactional email yes/no'MailingType': 'mobile', 'mailing'
Parameters
| string | $nl_title = '' | Only return actionmails with given title (optional) |
Return Value
| array|integer | Array of actionmails |
api_getGroupLastMailing
integer api_getGroupLastMailing( int $ev_id )
Returns the ID of the mailing last sent to the recipient group $ev_id.
Parameters
Return Value
api_getMailingContent
string|integer api_getMailingContent( int $nl_id )
SINCE 5.10.1 Returns the content source code of a published mailing $nl_id.Parameters
Return Value
| string|integer | Mailing content or error code |
api_getMailingsByStatus
array|integer api_getMailingsByStatus( string $status = '' )
Delivers an array of all mailings, which are currently in the specified status ($status='': all). The return is an array of the data sets of each mailing, containing e.g. start and end time, number of emails, abort reasons and number of recipients. Possible variants of the email status: 'on_hold', 'actionmail', 'ready', 'clearing', 'not_started', 'finished', 'processing', 'paused', 'aborted', 'failed', 'queued', 'scheduled', 'pending', 'sampling', 'deleted'
Parameters
| string | $status = '' | Newsletter status |
Return Value
| array|integer | Array of newsletters or error code |
api_getMessageInfo
array|integer api_getMessageInfo( string $message_name = '' , string $message_status = '' )
Delivers an array of all messages, which are currently in the [optional] specified $message_status or having the [optional] specified $message_name. The return is an array of the data sets of each message, containing name, identifier und status. Possible variants of the email status: 'on_hold', 'actionmail', 'ready', 'clearing', 'not_started', 'finished', 'processing', 'paused', 'aborted', 'failed', 'queued', 'scheduled', 'pending', 'sampling', 'deleted'
Parameters
| string | $message_name = '' | Message name |
| string | $message_status = '' | Message status |
Return Value
| array|integer | Array of messages or error code |
api_mailingAddressToGroup
boolean|integer api_mailingAddressToGroup( int $nl_id , int $group_id , string $type = 'ready' , bool $c_id = false )
Addresses the mailing with the $nl_id to the group $group_id. The parameter $type defines the clearing type. Possible values are:
'ready': without clearing.'not_startet': clearing allowed.'clearing': Requests clearing.
The $c_id specifies the campaign ID.
Parameters
| int | $nl_id | Newsletter ID |
| int | $group_id | Group ID |
| string | $type = 'ready' | Status |
| bool | $c_id = false | Campaign ID |
Return Value
| boolean|integer | Success or failure or error code |
api_mailingAddressToSegment
boolean|integer api_mailingAddressToSegment( int $nl_id , int $segment_id , string $type = 'ready' , bool $c_id = false )
Addresses the mailing with the $nl_id to the target group with the $segment_id. The other parameters perform the same as in the function api_mailingAddressToGroup().
Parameters
| int | $nl_id | Newsletter ID |
| int | $segment_id | Targetgroup ID |
| string | $type = 'ready' | Status |
| bool | $c_id = false | Campaign ID |
Return Value
| boolean|integer | Success or failure or error code |
api_mailingCopy
integer api_mailingCopy( int $nl_id , string $new_nl_name = '' , string $new_nl_title = '' , int $new_folder_id )
SINCE 5.10.1 Copies a mailing $nl_id and saves it with the name $new_nl_name. Optionally, you can specify a new code $new_nl_title and a new save folder $new_folder_id.Parameters
| int | $nl_id | Newsletter ID |
| string | $new_nl_name = '' | Name for the copied newsletter |
| string | $new_nl_title = '' | Title for the copied newsletter |
| int | $new_folder_id | Folder ID (default is "Mailing" folder) |
Return Value
api_mailingDelete
integer|boolean api_mailingDelete( int $nl_id )
SINCE 6.2.4 Moves the specified mailing to the recycle bin. If it already is in the recycle bin, it will be deleted including any assigned data. Mailings which are assigned to active data business rules, may not be deleted. In this case an error (-18) is thrown.Parameters
Return Value
api_mailingPause
boolean api_mailingPause( int $nl_id , bool $release = false )
Pauses the sending process of the specified mailing or deactivates the pause.
Parameters
| int | $nl_id | Newsletter ID |
| bool | $release = false | True for continue mailing |
Return Value
api_mailingRelease
boolean api_mailingRelease( int $nl_id , string $datetime = null , string $cycle = 'no' )
Starts the sending of the specified mailing. If no time (format 'YYYY-MM-DD HH:MM:SS') is given, the sending process will be started immediately. As mailings are always sent by means of the schedule mechanism, there may be a delay of a few minutes between the call-up of the function and the actual send start. The parameter $cycle can set up a cyclical sending process. Possible values are: 'no', 'day', 'week', 'month', 'year'
Parameters
| int | $nl_id | Newsletter ID |
| string | $datetime = null | Date and time to start delivery, format: 'yyyy-mm-dd hh:mm:ss' |
| string | $cycle = 'no' | Enum(no,day,week,month,year) defaults to no, sets a cycle |
Return Value
api_mailingRender
array|boolean api_mailingRender( int $elaine_id , int $mailing_id , array $userdata = array() , int $group , bool $preview = false )
Returns an associative array of a mailing (keys 'header' and 'body'). The data from the mailing $mailing_id will be processed for the recipient profile specified as $elaine_id.
Parameters
| int | $elaine_id | ELAINE profile ID |
| int | $mailing_id | Newsletter ID |
| array | $userdata = array() | Array of profile data (optional) |
| int | $group | Group for which the mail should be rendered (optional) |
| bool | $preview = false | Preview flag |
Return Value
| array|boolean | Array of newsletter content, header, body on success or false |
api_mailingStop
void api_mailingStop( int $nl_id )
Aborts the sending of the specified mailing.
Parameters
Return Value
api_mailingTestsend
boolean api_mailingTestsend( int $nl_id , int $ev_id )
Runs a test sending for the specified mailing. The $ev_id shows the ID of the group, to whose approval list the mailing is to be sent. Default is the addressed group.
Parameters
| int | $nl_id | Newsletter ID |
| int | $ev_id | Group ID to send testmailing to (defaults to FIRST addressed group) |
Return Value
api_mailingUnrelease
boolean api_mailingUnrelease( int $mailingID )
SINCE 6.2.4 Revokes clearing of the given mailing and moves it back to the "Ready for dispatch" folder. If the mailing had a scheduled delivery date, this is removed and must be configured again. A mailing that wasn't released yet or is already delivered, can not be unreleased and raises an error (-18). If the function is called for a single variant, an error is invoked (-18). Variants may only be unreleased via their container.Parameters
| int | $mailingID | Newsletter ID |
Return Value
api_sendSingle
boolean|integer api_sendSingle( int $nl_id , int $p_id , int $ev_id , int $priority = null , int $variant_position = null , string $type = 'normal' )
Sends the mailing with the ID $nl_id to the recipient with the profile ID $elaine_id with the sender data of the group $ev_id. Recipients on the Bounce- or Blacklist are excluded from dispatch.
Behavior in bulk mode: The bulk parameter $abort_on_error has no use for this function. The transferred block is either entirely processed or completely discarded. The bundled transmitted single calls must reference to the same $nl_id.
Parameters
| int | $nl_id | newsletter ID |
| int | $p_id | ELAINE profile ID |
| int | $ev_id | Group ID |
| int | $priority = null | Mailer priority: use null for system default |
| int | $variant_position = null | Variant position to send |
| string | $type = 'normal' | Normal or preview |
Return Value
| boolean|integer | Success or failure or error code |
api_userSendMail
boolean|integer api_userSendMail( int $mailing_id , int $user_id , int $group , bool $bcc = false , bool $preview = false )
Deprecated since 6.6.1 - Please do not use this function anymore. This function will be disabled in a future version. Instead, use the function api_sendSingle().
Sends the mailing referenced via $mailing_id to the recipient with the profile ID $user_id. For link personalisation, you can optionally enter a recipient group ID; the mailing will then be generated for the recipient as group member. Optionally, you can transfer an additional recipient as string. If $preview is set to true, this email will be sent as preview email.
Parameters
| int | $mailing_id | Newsletter ID |
| int | $user_id | ELAINE profile ID |
| int | $group | Group ID |
| bool | $bcc = false | Blind carbon copy |
| bool | $preview = false | As preview? |
Return Value
| boolean|integer | Success or failure or error code |