API reference: Message management

Prev Next

 API reference: Message management documents the function signatures, parameters, return values, and error behavior of the Elaine HTTP API.

Note

Function availability depends on the Elaine release and enabled features. Authenticate HTTP requests with an Elaine-issued Bearer JWT.

Function overview
boolean|integerapi_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.
integerapi_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|integerapi_getActionmails ( string $nl_title = '' )
Returns an array with all action emails.
integerapi_getGroupLastMailing ( int $ev_id )
Returns the ID of the mailing last sent to the recipient group $ev_id.
string|integerapi_getMailingContent ( int $nl_id )
Returns the content source code of a published mailing $nl_id.
array|integerapi_getMailingsByStatus ( string $status = '' )
Delivers an array of all mailings, which are currently in the specified status ($status='': all).
array|integerapi_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|integerapi_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|integerapi_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.
integerapi_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|booleanapi_mailingDelete ( int $nl_id )
Moves the specified mailing to the recycle bin.
booleanapi_mailingPause ( int $nl_id , bool $release = false )
Pauses the sending process of the specified mailing or deactivates the pause.
booleanapi_mailingRelease ( int $nl_id , string $datetime = null , string $cycle = 'no' )
Starts the sending of the specified mailing.
array|booleanapi_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').
voidapi_mailingStop ( int $nl_id )
Aborts the sending of the specified mailing.
booleanapi_mailingTestsend ( int $nl_id , int $ev_id )
Runs a test sending for the specified mailing.
booleanapi_mailingUnrelease ( int $mailingID )
Revokes clearing of the given mailing and moves it back to the "Ready for dispatch" folder.
boolean|integerapi_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|integerapi_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_idNewsletter ID
int$group_idGroup ID
int$segment_idTargetgroup ID
string$status = 'ready'Status
bool$c_id = falseCampaign ID

Return Value

boolean|integerSuccess 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_idTemplate ID
string$nl_nameNewsletter name
string$nl_title = ''Newsletter title
int$folder_idFolder ID

Return Value

integerNew 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|integerArray 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

int$ev_idGroup ID

Return Value

integerMailing ID


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

int$nl_idNewsletter ID

Return Value

string|integerMailing 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|integerArray 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|integerArray 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_idNewsletter ID
int$group_idGroup ID
string$type = 'ready'Status
bool$c_id = falseCampaign ID

Return Value

boolean|integerSuccess 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_idNewsletter ID
int$segment_idTargetgroup ID
string$type = 'ready'Status
bool$c_id = falseCampaign ID

Return Value

boolean|integerSuccess 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_idNewsletter ID
string$new_nl_name = ''Name for the copied newsletter
string$new_nl_title = ''Title for the copied newsletter
int$new_folder_idFolder ID (default is "Mailing" folder)

Return Value

integerNewsletter ID


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

int$nl_idNewsletter ID

Return Value

integer|boolean


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_idNewsletter ID
bool$release = falseTrue for continue mailing

Return Value

booleanSuccess


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_idNewsletter ID
string$datetime = nullDate 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

booleanSuccess


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_idELAINE profile ID
int$mailing_idNewsletter ID
array$userdata = array()Array of profile data (optional)
int$groupGroup for which the mail should be rendered (optional)
bool$preview = falsePreview flag

Return Value

array|booleanArray 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

int$nl_idNewsletter ID

Return Value

voidSuccess


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_idNewsletter ID
int$ev_idGroup ID to send testmailing to (defaults to FIRST addressed group)

Return Value

booleanSuccess


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$mailingIDNewsletter ID

Return Value

boolean


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_idnewsletter ID
int$p_idELAINE profile ID
int$ev_idGroup ID
int$priority = nullMailer priority: use null for system default
int$variant_position = nullVariant position to send
string$type = 'normal'Normal or preview

Return Value

boolean|integerSuccess 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_idNewsletter ID
int$user_idELAINE profile ID
int$groupGroup ID
bool$bcc = falseBlind carbon copy
bool$preview = falseAs preview?

Return Value

boolean|integerSuccess or failure or error code