Internal Functions

There are some internal functions, e.g. for encoding parameters in hyperlinks.

Default placeholders, you must not use functions for it:

[Date_short]

Date in short format it depends on your Windows settings

[Date_long]

Date in long format it depends on your Windows settings

[Time_short]

Time in short format it depends on your Windows settings

[Time_long]

Time in long format it depends on your Windows settings

[Date_own_format]

You can define own date format, menu Project - Define your own date/time format

[Time_own_format]

You can define own time format, menu Project - Define your own date/time format

[Mail_Recipient_Count]

Count of recipients in recipients list with a check mark.

[EMail_LocalPart]

Local part of email address, e.g. john@doe.com, Result: john

[EMail_DomainPart]

Domain part of email address, e.g. john@doe.com, Result: doe.com
[~EMail~] Email address of recipient, independently of field name with email address in recipients list (req. SuperMailer 14.00)
[~ID~] Internal ID of recipient in SuperMailer recipients database.
[~SUBJECT~] Allows to show subject of email in HTML and/or plain text part of email. Can't be used in personalized attachments.

 

Hints

 

Syntax

sf_<functionname>( <argument> )

All values in < > are mandatory values.

Sample: sf_base64_encode(A TEXT) Result: QSBURVhU

 

Nested functions

Nesting of functions are allowed.

sf_<functionname>( sf_<functionname>(<argument>) )

All values in < > are mandatory values.

Sample: sf_base64_decode( sf_base64_encode(A TEXT) ) Result A TEXT

 

List of functions

 

sf_base64_encode(<value>) Encodes characters base64.

Sample: sf_base64_encode(text)

 

sf_base64_decode(<value>) Decodes base64 characters .

Sample: sf_base64_decode(RUlOIFRFWFQ=)

 

sf_url_encode(<value>) Encodes characters url encoded, use this functions for parameters of hyperlinks.

Sample: sf_url_encode(a Text with blanks) => a%20Text%20with%20blanks

 

sf_url_encode_all(<value>) Encodes ALL characters url encoded, use this functions for parameters of hyperlinks.

Sample: sf_url_encode_all(a Text with blanks) => %61%20%54%65%78%74%20%77%69%74%68%20%62%6C%61%6E%6B%73

 

sf_url_decode(<value>) Decodes url encoded characters.

Sample: sf_url_decode(a+Text+with+blanks)

 

sf_htmlentities(<value>) Converts characters to HTML entities.

Sample: sf_htmlentities(<a text>)

 

sf_unhtmlentities(<value>) Converts HTML entities to plain text.

Sample: sf_unhtmlentities(&lt;a text&gt;)

 

sf_sha1(<value>) Calculates sha1 hash.

Sample: sf_sha1(abc)

 

sf_md5(<value>) Calculates md5 hash.

Sample: sf_md5(abc)

 

sf_sha2_256(<value>), sf_sha2_384(<value>), sf_sha2_512(<value>) Calculates sha2 hash.

Sample: sf_sha2_256(abc)

 

sf_domain_part(<email address>) Retrieves domain part of an email address. When there are no @ character than a blank text will be used.

Sample: sf_domain_part(john@doe.com) => doe.com

 

sf_local_part(<email address>) Retrieves local part of an email address. When there are no @ character than a blank text will be used.

Sample: sf_local_part(john@doe.com) => john

 

sf_tld(<email address>) Retrieves top level domain of an email address. When there are no @ character than a blank text will be used.

Sample: sf_tld(john@doe.com) => com

 

sf_lowercase(<value>) All characters will be converted to lower case characters.

 

sf_uppercase(<value>) All characters will be converted to upper case characters.

 

sf_lcfirst(<value>) Converts first char to a lower case character.

 

sf_ucfirst(<value>) Converts first char to an upper case character.

 

sf_trim(<value>) Removes leading/trailing spaces.

 

sf_ltrim(<value>) Removes leading spaces.

 

sf_rtrim(<value>) Removes trailing spaces.

 

sf_nl2br(<value>) Changes all line breaks to <br>

 

sf_hex(<number>) Converts characters to a number and after than to a hexadecimal number,

Sample: sf_hex(12345)

 

sf_rand(<number>) Creates a random number in range.

Sample: sf_rand(10)

 

sf_add(<number>, <number> [,<number>...]) Adds comma delimited numbers.

Samples: sf_add(1, 2, 3)

 

sf_sub(<number>, <number> [,<number>...]) Subtracts comma delimited numbers.

Sample: sf_sub(3, 2, 1)

 

sf_mul(<number>, <number> [,<number>...]) Multiplies comma delimited numbers.

Sample: sf_mul(3, 2, 1)

 

sf_div(<number>, <number> [,<number>...]) Divides comma delimited numbers..

Sample: sf_div(3, 2)

 

sf_muldiv(<number>, <numerator>, <denominator>) Multiplies <number> with <numerator> and divides with <denominator>

Sample: sf_muldiv(3, 2, 3) => 2

 

sf_divmul(<number>, <denominator>, <number1>) Divides <number> with <denominator> and multiplies with <number1>

Sample: sf_divmul(3, 2, 1) => 1.5

 

sf_abs(<number>) Returns absolut value of a number.

Sample: sf_abs(-123) or e.g. sf_abs(sf_sub(3, 10))

 

sf_toint(<floating point number>) Converts a decimal number to an integer number, all digits after decimal point will be cuted. Alternatively it converts a hexadecimal number to a decimal number, number must start with 0x.

Sample: sf_toint(123.456) or sf_toint(0xFFAAFF)

 

sf_tofloat(<number>) Converts a number to a floating point number. It's possibly necessary to use this function with sf_format() for formating integer values as floating point values.

Sample:

sf_format(%2.f, 1) => Gives an error 1 is an integer not a floating point number, you must use this variant:

sf_format(%2.f, sf_tofloat(1)) => Result 1.00

 

sf_rand_string_mixed(<size>)

Creates a random string with uppercase/lowercase characters and numbers.

 

With <size> you can specify length of string, default 8.

 

sf_rand_string_uppercase(<size>) Creates a random string with uppercase characters and numbers.

With <size> you can specify length of string, default 8.

 

sf_rand_string_lowercase(<size>) Creates a random string with lowercase characters and numbers.

With <size> you can specify length of string, default 8.

 

sf_rand_string_from_array(<value1>,<value2>...) Selects random a value from a comma separated list.

Sample: sf_rand_string_from_array(a, b, c, d, e, f)

 

sf_rand_image(image0, image1, image2)

 

Selects an image random from list and sends it.

Sample: sf_rand_image(https://int.supermailer.de/images/supermailer.png, file://c:/images/image.png, file://c:/images/image1.png)

 

sf_substring(<string>, <start>, [length]) Extracts a substring from <string>. <start> begins at 1, length is optionally.

 

sf_pos(<string>, <findstring>, [value]) Find position of <findstring> in <string>, when <findstring> doesn't appear it returns 0. As how sf_substring(), the counting of characters starts from character 1, not 0. Optionally you can specify a value which should be subtracted from find position.

Sample

Email address: john@doe.com

sf_substring([EMail_DomainPart], 1, sf_pos([EMail_DomainPart], . , 1))

result as doe

 

sf_today([format]) Outputs current date, without [format] sf_today() is identically with default placeholder [Date_short].

You can format outputted date, Formatting Date/Time.

Samples

sf_today() => 2021-02-04

sf_today(mmmm) => February

 

sf_tomorrow([format]) Outputs tomorrow's date.

You can format outputted date, Formatting Date/Time.

 

sf_yesterday([format]) Outputs yesteday's date.

You can format outputted date, Formatting Date/Time.

 

sf_incdays(<date>, <days>[, destformat][, srcformat]) Adds to given date count of days. Days can be negative to subtract days from given date.

Date and days are mandatory fields, destformat and srcformat optionally. You must give a value for srcformat when format of date is not identically with Windows date format.

For destformat and srcfromat you can format outputted/inputted date, Formatting Date/Time.

Samples

sf_incdays(2021-02-04, 10) => 2021-02-14

sf_incdays(2021-02-04, -10) => 2021-01-25

sf_incdays(2021-02-04, 30, mmyyyy) => 032021

sf_incdays(2021-02-04, 14, dd.mm.yyyy) => 18.02.2021

 

sf_incweeks(<date>, <weeks>[, destformat][, srcformat]) Adds to given date count of weeks. Weeks can be negative to subtract weeks from given date.

Date and weeks are mandatory fields, destformat and srcformat optionally. You must give a value for srcformat when format of date is not identically with Windows date format.

For destformat and srcfromat you can format outputted/inputted date, Formatting Date/Time.

 

sf_incyears(<date>, <years>[, destformat][, srcformat]) Adds to given date count of years. Years can be negative to subtract years from given date.

Date and years are mandatory fields, destformat and srcformat optionally. You must give a value for srcformat when format of date is not identically with Windows date format.

For destformat and srcfromat you can format outputted/inputted date, Formatting Date/Time.

 

 

sf_format(<format>, [argument1], [argument2]...) Formats a number or string with format strings.

Samples

sf_format(USD %2.f, 1.20) => USD 1.20
sf_format(%d, 123456) => 123456
sf_format(USD %01.2f, sf_add(1000.5, 2000.75)) => USD 3001,25
sf_format(%2.f%%, 95.3) => 95.30%

 

 

Formatting Date/Time

"ShortDateFormat" => Windows default short dateformat, e.g. Year-Month-Day

"LongDateFormat" => Windows default long dateformat, e.g. Year-Month-Day Hour:Minute:Second

/
Displays the date separator character given by the date separator global variable.
:
Displays the time separator character given by the time separator global variable.
c
Displays the date using the format given by the "ShortDateFormat" global variable, followed by the time using the format given by the "LongTimeFormat" global variable. The time is not displayed if the date-time value indicates midnight precisely.
d
Displays the day as a number without a leading zero (1-31).
dd
Displays the day as a number with a leading zero (01-31).
ddd
Displays the day as an abbreviation (Sun-Sat) using the strings given by the "ShortDayNames" global variable.
dddd
Displays the day as a full name (Sunday-Saturday) using the strings given by the "LongDayNames" global variable.
ddddd
Displays the date using the format given by the "ShortDateFormat" global variable.
dddddd
Displays the date using the format given by the "LongDateFormat" global variable.
m
Displays the month as a number without a leading zero (1-12). If the m specifier immediately follows an h or hh specifier, the minute rather than the month is displayed.
mm
Displays the month as a number with a leading zero (01-12). If the mm specifier immediately follows an h or hh specifier, the minute rather than the month is displayed.
mmm
Displays the month as an abbreviation (Jan-Dec) using the strings given by the "ShortMonthNames" global variable.
mmmm
Displays the month as a full name (January-December) using the strings given by the "LongMonthNames" global variable.
yy
Displays the year as a two-digit number (00-99).
yyyy
Displays the year as a four-digit number (0000-9999).
h
Displays the hour without a leading zero (0-23).
hh
Displays the hour with a leading zero (00-23).
n
Displays the minute without a leading zero (0-59).
nn
Displays the minute with a leading zero (00-59).
s
Displays the second without a leading zero (0-59).
ss
Displays the second with a leading zero (00-59).
z
Displays the millisecond without a leading zero (0-999).
zzz
Displays the millisecond with a leading zero (000-999).
t
Displays the time using the format given by the "ShortTimeFormat" global variable.
tt
Displays the time using the format given by the "LongTimeFormat" global variable.
am/pm
Uses the 12-hour clock for the preceding h or hh specifier, and displays 'am' for any hour before noon, and 'pm' for any hour after noon. The am/pm specifier can use lower, upper, or mixed case, and the result is displayed accordingly.
a/p
Uses the 12-hour clock for the preceding h or hh specifier, and displays 'a' for any hour before noon, and 'p' for any hour after noon. The a/p specifier can use lower, upper, or mixed case, and the result is displayed accordingly.
ampm
Uses the 12-hour clock for the preceding h or hh specifier, and displays the contents of the TimeAMString global variable for any hour before noon, and the contents of the "TimePMString" global variable for any hour after noon.

Format Strings

 

Value Meaning

d

Decimal. The argument must be an integer value. The value is converted to a string of decimal digits. If the format string contains a precision specifier, it indicates that the resulting string must contain at least the specified number of digits; if the value has less digits, the resulting string is left-padded with zeros.

u

Unsigned decimal. Similar to d, but no sign is output.

e

Scientific. The argument must be a floating-point value. The value is converted to a string of the form "-d.ddd...E+ddd". The resulting string starts with a minus sign if the number is negative. One digit always precedes the decimal point. The total number of digits in the resulting string (including the one before the decimal point) is given by the precision specifier in the format string; a default precision of 15 is assumed if no precision specifier is present. The "E" exponent character in the resulting string is always followed by a plus or minus sign and at least three digits.

f

Fixed. The argument must be a floating-point value. The value is converted to a string of the form "-ddd.ddd...". The resulting string starts with a minus sign if the number is negative. The number of digits after the decimal point is given by the precision specifier in the format string—a default of 2 decimal digits is assumed if no precision specifier is present.

g

General. The argument must be a floating-point value. The value is converted to the shortest possible decimal string using fixed or scientific format. The number of significant digits in the resulting string is given by the precision specifier in the format string; a default precision of 15 is assumed if no precision specifier is present. Trailing zeros are removed from the resulting string, and a decimal point appears only if necessary. The resulting string uses the fixed-point format if the number of digits to the left of the decimal point in the value is less than or equal to the specified precision, and if the value is greater than or equal to 0.00001. Otherwise the resulting string uses scientific format.

n

Number. The argument must be a floating-point value. The value is converted to a string of the form "-d,ddd,ddd.ddd...". The n format corresponds to the f format, except that the resulting string contains thousand separators.

m

Money. The argument must be a floating-point value. The value is converted to a string that represents a currency amount.

s

String. The argument must be a character or a string value. The string or character is inserted in place of the format specifier. The precision specifier, if present in the format string, specifies the maximum length of the resulting string. If the argument is a string that is longer than this maximum, the string is truncated.

x

Hexadecimal. The argument must be an integer value. The value is converted to a string of hexadecimal digits. If the format string contains a precision specifier, it indicates that the resulting string must contain at least the specified number of digits; if the value has fewer digits, the resulting string is left-padded with zeros.

Conversion characters may be specified in uppercase as well as in lowercase; both produce the same results.

To display the character % (that is, to display a literal %, not to begin a format specifier), use the sequence %%.