Skip to content

SAREscript functions ​

String processing ​

lastchar - Returns the last character of a string.

str_pad - Pads a string to the specified length.

str_split - Splits a string into parts.

str_repeat - Repeats a string the specified number of times.

strtolower - Converts uppercase letters to lowercase.

strtoupper - Converts lowercase letters to uppercase.

trim - Removes whitespace from the beginning and end of a string.

substr - Returns a specified part of a string.

substr_count - Counts occurrences of one string in another.

ucfirst - Converts the first letter of a string to uppercase.

strlen - Returns the number of characters in the supplied string.

strpos - Returns the numeric position of the first occurrence of the searched character.

Math and variables ​

ok - Always returns true.

not - Negates its argument.

rand - Returns a random number within the specified range.

next - Moves the array pointer to the next element and returns its value.

isset - Checks whether a variable has been created.

key - Returns the key of the current array element.

is_array - Checks whether the supplied argument is an array.

in_array - Checks whether an array contains a specific value.

array_search - Searches an array for a value.

array_pop - Returns the last array value and removes it from the array.

array_reverse - Reverses the order of array elements.

array_merge_indexes - Returns a sorted array of indexes describing the input arrays.

array_merge_values - Returns a sorted array of values from the input arrays.

empty - Checks whether an argument is empty.

explode - Splits a string and returns an array of its parts.

serialize - Converts the supplied value to a storable representation.

unserialize - Restores data generated by serialize.

base64_decode - Decodes MIME base64 data.

base64_encode - Encodes data using MIME base64.

md5 - Returns the 32-character MD5 hash of the supplied value.

urlencode - Encodes a value so it can safely be used as part of a URL.

urldecode - Decodes a value encoded with urlencode.

json_decode - Decodes a JSON string.

json_encode - Converts a value to JSON.

sort - Sorts values in ascending order.

rsort - Sorts values in descending order.

asort - Sorts array values in ascending order while preserving their keys.

arsort - Sorts array values in descending order while preserving their keys.

unset - Removes a variable.

min - Returns the smallest of the supplied values.

max - Returns the largest of the supplied values.

iconv - Converts $lancuch to a new character encoding.

count - Returns the number of array elements.

current - Returns the value of the current array element.

intval - Converts an argument to an integer.

Date and time ​

date - Returns a formatted date.

time - Returns the current Unix timestamp.

strtotime - Parses most English date and time descriptions into a Unix timestamp.

mktime - Calculates the Unix timestamp for a specified date.

passed_today - Checks whether the interval specified by the second argument has elapsed between the dates in the first and third arguments.

Output ​

barcode_ean13 - Inserts an HTML tag displaying an EAN13 barcode into the message.

qr_encode - Inserts an HTML tag displaying a QR code into the message.

print - Inserts the supplied string into the message or displays it as script output.

print_r - Inserts a readable representation of a variable into the message or displays it as script output.

exit - Stops script execution.

Database and external data ​

registry_get - Returns the contents of a registry.

registry_set - Writes a value to a registry.

registry_unset - Deletes a registry.

registry_append - Appends a value to the named registry.

bigregistry_get - Returns the contents of a BIG registry.

bigregistry_set - Writes a value to a BIG registry.

bigregistry_unset - Deletes a BIG registry.

bigregistry_append - Appends a value to the named BIG registry.

get_url - Fetches the content at the specified URL.

set_val - Saves data associated with the current email address to the database.

set_val_multiple - Sets database properties associated with the current email address.

get_val - Returns data associated with the current email address.

Campaigns ​

campaign_all - Returns status information for all addresses participating in the selected campaign.

campaign_clicked - Returns the number of clicked messages in the selected campaign for the current email address.

campaign_domains - Returns campaign sends, bounces, opens, clicks and unsubscribes grouped by domain.

campaign_geoip - Returns geolocation data for email opens in the campaign.

campaign_total_clicked - Returns the total number of clicks in the selected campaign.

campaign_opened - Returns the number of opened messages in the selected campaign for the current email address.

campaign_total_opened - Returns the open rate for the selected campaign.

campaign_openrate - Returns the open rate for the selected campaign and current email address.

campaign_total_openrate - Returns the number of opened messages in the selected campaign.

campaign_ctr - Returns the CTR for the selected campaign and current email address.

campaign_total_ctr - Returns the CTR for the selected campaign.

campaign_total_sent - Returns the number of emails sent in the selected campaign.

campaign_mailings - Returns an array of mailing IDs in a campaign.

campaign_distribution - Returns sends, deliveries, clicks, unsubscribes and bounces for the specified mailing.

campaign_name - Returns the name of the selected campaign.

campaign_links - Returns an array of information about links in the specified campaign.

campaign_tags - Returns all tag names and click counts for tagged links across the mailings in the specified campaign.

campaign_list - Returns an array containing the IDs and names of all campaigns.

campaign_timeline_opened_day - Returns campaign open counts by date.

campaign_timeline_opened_week - Returns campaign open counts by day of the week.

campaign_timeline_clicked_hour - Returns campaign click counts by hour.

campaign_timeline_clicked_day - Returns campaign click counts by date.

campaign_total_bounced - Returns the total number of bounces for the specified campaign ID.

campaign_total_opted_out - Returns the number of addresses that unsubscribed during the selected campaign.

t_campaign_statistics - Returns overall transactional mailing statistics for the selected campaign.

t_campaign_domains - Returns transactional mailing statistics for the selected campaign grouped by recipient domain.

e_campaign_sent - Returns the IDs of campaign mailings sent to the current email address.

Mailing ​

bind_email - Sets the specified email address as the current context.

bind_hash - Sets the specified hashed email address as the current context.

mailing_all - Returns status information for all addresses participating in a mailing.

mailing_info_get - Returns an array of general information about a mailing.

mailing_info_count - Returns the number of emails sent and scheduled during the specified mailing.

mailing_distribution - Returns sends, deliveries, clicks, unsubscribes and bounces for the specified mailing.

mailing_clicked - Checks whether a click was recorded for the current email address in the specified mailing.

mailing_total_clicked - Returns the number of clicked email messages in the specified mailing.

mailing_opened - Checks whether an open was recorded for the current email address in the specified mailing.

mailing_total_opened - Returns the number of opened email messages in the specified mailing.

mailing_bounced - Checks whether a bounce was recorded for the current email address in the specified mailing.

mailing_bounced_status - Returns the bounce code recorded for the current email address in the specified mailings.

mailing_total_bounced - Returns bounce counts for the selected mailings.

mailing_sent - Checks whether an email was sent to the current address in the specified mailing.

mailing_total_sent - Returns the number of emails sent in the specified mailing.

mailing_sent_count - Returns the number of emails sent to the current address within the specified period.

mailing_send - Sends a mailing.

mailing_send_test - Sends a test mailing to $email_testowy.

mailing_resend - Resends a mailing.

mailing_comment_set - Saves the supplied text as a comment on the specified mailing.

mailing_comment_get - Retrieves the comment saved for the specified mailing.

mailing_comment_append - Appends the supplied text to the existing comment on the specified mailing.

mailing_clicked_link - Checks whether the current email address clicked the specified link in the specified mailing.

mailing_total_ctr - Returns the CTR for the specified mailing.

mailing_total_openrate - Returns the open rate for the specified mailing.

mailing_total_opted_out - Returns the number of addresses that unsubscribed during the selected mailings.

mailing_tags_clicked - Returns all mailing tags and indicates whether a particular email address clicked each tagged link.

mailing_agent - Returns mailing open and click counts grouped by browser and operating system.

mailing_geoip - Returns geolocation data for mailing opens and clicks.

mailing_links - Returns information about links used in messages sent in the specified mailings.

mailing_open_reach - Returns the ratio of opens to delivered emails, from 0 to 1, for the selected mailings.

mailing_tags - Returns link tags and the number of clicks on all links sharing each tag.

mailing_domains - Returns mailing sends, bounces, opens, clicks and unsubscribes grouped by domain.

mailings_id - Returns mailing IDs within the specified time range.

t_mailings_id - Returns transactional mailing IDs within the specified time range.

t_mailing_info_get - Returns general information about a transactional mailing.

mailing_timeline_clicked_day - Returns click counts by date for the selected mailings.

mailing_timeline_clicked_hour - Returns click counts by hour for the selected mailings.

mailing_timeline_opened_day - Returns open counts by date for the selected mailings.

mailing_timeline_clicked_week - Returns click counts by day of the week for the selected mailings.

mailing_timeline_opened_hour - Returns click counts by hour for the selected mailings.

mailing_timeline_opened_week - Returns open counts by day of the week for the selected mailings.

mailing_planned_count - Returns the total number of emails scheduled for the current email address.

mail_send - Sends a message to the specified $email address.

tags_clicked - Returns all tags clicked by the specified email address within a given period.

tag_clicked - Checks whether the current address clicked the specified tag.

tag_clicked_all - Returns the number of tag clicks for the current address.

get_links - Returns links from the selected mailing.

unsubscribe - Unsubscribes the current address from the subscriber list.

SMS ​

sms_received - Checks whether an SMS was received for the current email address in the specified SMS mailing.

sms_sent - Checks whether an SMS was sent for the current email address in the specified SMS mailing.

sms_send - Sends an SMS mailing.

sms_info_get - Returns general information about a completed or scheduled SMS mailing.

sms_clicked_count - Returns the number of clicked SMS messages in the specified mailing.

sms_total_ctr - Returns the CTR for the specified SMS campaign.

sms_info_count - Returns the number of SMS messages sent and scheduled.

sms_sent_count - Returns the number of SMS messages sent in the selected campaign.

sms_campaign_sent - Returns the number of SMS messages sent to the current address in the selected campaign.

sms_campaign_name - Returns the campaign name for the supplied argument.

sms_allowed_senders - Returns all configured SMS sender IDs available for Pro messages.

Message templates ​

newsletter_ready_by_name - Returns the ID of a ready-to-send message template by name.

newsletter_info_get - Displays information about the selected message template.

newsletter_delete - Deletes a ready-to-send message template by ID.

Quarantine ​

email_to_quarantine - Adds the specified email address to the email quarantine.

remove_email_from_quarantine - Removes the specified email address from the email quarantine.

gsm_to_quarantine - Adds the specified GSM number to the SMS quarantine.

remove_gsm_from_quarantine - Removes the specified GSM number from the SMS quarantine.

Groups ​

sare_groups - Returns the IDs of groups containing the current email address.

sare_in_group - Checks whether the current email address belongs to the specified group.

sare_group_add - Adds the current address to a group.

sare_group_remove - Removes the current address from a group.

sare_group_copy - Copies addresses from group X to group Y.

sare_group_info - Returns an array of group information.

System functions ​

system_setfrom - Sets the From field when sending a newsletter.

system_skipmessage - Skips sending the newsletter to the current address.

system_setsubject - Sets the Subject field when sending a newsletter.

sare_property - Returns the properties defined in the system and their settings.

Additional functions ​

find_by_gsm - Returns database addresses with the specified phone number.

get_request - Returns parameters passed in an HTTP request.

get_request_agent - Returns information about the user's browser, operating system and device.

get_request_ip - Returns the IP address of the user's device.

pl_imiewolacz - Returns the vocative form of the supplied Polish first name.

pl_imiedeklinacja - Returns a Polish first name inflected for the specified grammatical case.

pl_plec - Returns gender based on a first name.

pl_kody - Calculates the distance between two towns using postal codes.

pl_slownie - Converts a number to words in Polish.

redirect - Redirects to the specified URL.

datasources_list_all - Returns an array of information about all data sources configured on the account.

zipcode_info_get - Returns city and province information for the specified postal code.

zipcode_distance - Calculates the distance between postal codes.

survey_report_get - Returns a CSV report for the survey identified by $surveyId.

e_message_last_sent - Checks whether an email or SMS message was sent within a given period.

ss_cyclic_change_time - Changes the execution time of a recurring SAREscript script.

sms_cyclic_change_time - Changes the send time of a recurring SMS mailing.

mailing_cyclic_change_time - Changes the send time of a recurring email mailing.

remove_email - Deletes the specified email address from the database.