Lua Functions Summary

March 26, 2020 Contributors

This section contains tables of Lua functions. Click the function name for details.

Function/Description Params Package Version Phases
ac:esmtp_capability_add – Add a capability to the EHLO response name msys.extended.ac 4.0 connect, ehlo
ac:esmtp_capability_remove – Removes a capability string from the EHLO response name msys.extended.ac 4.0 connect, ehlo
ac:inbound_session_count – If called with no arguments, returns the current inbound session count to this listener for the connecting IP [cidr], [service_type] msys.extended.ac 4.0 any
client:do_request – Perform an HTTP request type, url, [data] msys.http.client 4.0 any
client:get_body – Get the body of a web page msys.http.client 4.0 any
client:get_headers – Get a client’s headers msys.http.client 4.0 any
client:get_status – Return the status of an HTTP request msys.http.client 4.0 any
client:parse_headers – Parse the headers of an HTTP response headers msys.http.client 4.0 any
client:set_header – Set a client’s header [header] msys.http.client 4.0 any
client:set_timeout – Set the timeout for an HTTP client [number] msys.http.client 4.0 any
json.decode – Create a JSON object from a JSON string str json 4.0 any
json.encode – Convert a Lua variable or expression so that it can be added to a JSON object obj json 4.0 any
json.new – Create an empty JSON object json 4.0 any
json.strerror – Return the description of a JSON error code code json 4.0 any
msg.batch_id – Returns the human-readable ec_message.batch_id msys.extended.message 4.0 data, data_spool, data_spool_each_rcpt, set_binding
msg.conn_id – Returns the human-readable ec_message.conn_id msys.extended.message 4.0 data, data_spool, data_spool_each_rcpt, set_binding
msg.id – Returns the human-readable ec_message.id msys.extended.message 4.0 data, data_spool, data_spool_each_rcpt, set_binding
msg:binding – Sets the binding to the named binding, if one is provided [value] msys.extended.message 4.0 set_binding
msg:binding_group – Sets the binding_group to the named binding, if one is provided [value] msys.extended.message 4.0 set_binding
msg:body – Set or get the message body (minus headers) […] msys.extended.message 4.0 data, data_spool, data_spool_each_rcpt, set_binding
msg:body_match – Streaming interface to a PCRE search of a message body (minus headers) pattern msys.extended.message 4.0 data, data_spool, data_spool_each_rcpt, set_binding
msg:body_replace – Streaming interface to a PCRE replacement of a message body (minus headers) pattern, replacement msys.extended.message 4.0 data, data_spool, data_spool_each_rcpt
msg:build – Create a message headers, parts, attachments msys.extended.message 4.0 data, data_spool, data_spool_each_rcpt, set_binding
msg:code – Get or set the message code [number], [string] msys.extended.message 4.0 data, data_spool, data_spool_each_rcpt
msg:context_delete – Delete a context variable type, key msys.core 4.0 data, data_spool, data_spool_each_rcpt, set_binding
msg:context_exists – Check if a context variable exists type, key msys.core 4.0 data, data_spool, data_spool_each_rcpt, set_binding
msg:context_exists_and_get – Check if a context variable exists and get it type, key msys.core 4.0 data, data_spool, data_spool_each_rcpt, set_binding
msg:context_get – Get a context variable type, key msys.core 4.0 data, data_spool, data_spool_each_rcpt, set_binding
msg:context_set – Set a context variable type, key, value msys.core 4.0 data, data_spool, data_spool_each_rcpt, set_binding
msg:discard – Silently discard a message [reason] msys.extended.message 4.0 data, data_spool, data_spool_each_rcpt
msg:forward – Forward current message to recipients other than the original recipients. A new message is created and the original message is attached to it sender, rcptto, text, [subject], [charset] msys.extended.message 4.0 data, data_spool, data_spool_each_rcpt, rcptto, set_binding
msg:get_delivery_method – Return the delivery method for a message msys.core 4.0 data, data_spool, data_spool_each_rcpt
msg:get_envelope2 – Get envelope values flags, localpart_str, domain_str msys.extended.message 4.0 data, data_spool, data_spool_each_rcpt, set_binding
msg:get_message_size – Get the size of a message msys.core 4.0 data, data_spool, data_spool_each_rcpt
msg:header – Manipulate message headers hdr, [value], [mode] msys.extended.message 4.0 data, data_spool, data_spool_each_rcpt, set_binding
msg:inject – Use this function to send mail mailfrom, rcptto msys.extended.message 4.0 data, data_spool, data_spool_each_rcpt, set_binding
msg:listener_addr – Gets the recv_via IP and/or PORT [flag] msys.extended.message 4.0 data, data_spool, data_spool_each_rcpt
msg:mailfrom – Sets the ‘MAIL FROM’ email address if one is provided. Returns the current/new value [value] msys.extended.message 4.0 data, data_spool, data_spool_each_rcpt, rcptto, set_binding
msg:makeBoundary – Generates a unique boundary string msys.extended.message 4.0 data, data_spool, data_spool_each_rcpt
msg:makeContainer – Creates a new, unlinked, container message part mimetype, [boundary], [add_terminator] msys.extended.message 4.0 data, data_spool, data_spool_each_rcpt
msg:makePart – Creates a new, unlinked, singleton (or leaf) message part mimetype, [body], [encoding] msys.extended.message 4.0 data, data_spool, data_spool_each_rcpt
msg:mime – Returns the top of the MIME tree for the message, a message part [readonly] msys.extended.message 4.0 data, data_spool, data_spool_each_rcpt
msg:raw – Sets the message content if value is provided [value] msys.extended.message 4.0 data, data_spool, data_spool_each_rcpt
msg:raw_match – Streaming interface to PCRE search message content pattern msys.extended.message 4.0 data, data_spool, data_spool_each_rcpt
msg:raw_replace – Streaming interface to a PCRE replacement of message content pattern, replacement msys.extended.message 4.0 data, data_spool, data_spool_each_rcpt
msg:rcptto – Sets the ‘RCPT TO’ email address if one is provided. Returns the current/new value [value] msys.extended.message 4.0 data, data_spool, data_spool_each_rcpt, rcptto, set_binding
msg:reception_peer – Returns the IP and/or PORT of the remote injection source [flag] msys.extended.message 4.0 data, data_spool, data_spool_each_rcpt
msg:routing_domain – Returns the routing domain for the message […] msys.extended.message_routing 4.0 data_spool_each_rcpt, rcptto
msg:text – Returns the transfer decoded text for the body msys.extended.message 4.0 data, data_spool, data_spool_each_rcpt
msg:text – The entire message body is replaced by the supplied text value, [type], [charset] msys.extended.message 4.0 data, data_spool, data_spool_each_rcpt
msg:text_match – Streaming PCRE search across the transfer-decoded, UTF-8 text version of the message body pattern msys.extended.message 4.0 data, data_spool, data_spool_each_rcpt
msg:text_replace – Streaming interface to PCRE replacement of textual content from the message body pattern, replacement msys.extended.message 4.0 data, data_spool, data_spool_each_rcpt
msgpart:addFirstChild – Adds a child as the first child on this part child msys.extended.message 4.0 data, data_spool, data_spool_each_rcpt
msgpart:addLastChild – Adds a child as the last child on this part child msys.extended.message 4.0 data, data_spool, data_spool_each_rcpt
msgpart:address_header – Parse each instance of the named header for RFC2822 addresses headername, [component] msys.extended.message 4.0 data, data_spool, data_spool_each_rcpt
msgpart:body_match – Streaming interface to PCRE search a message body part (minus headers) pattern msys.extended.message 4.0 data, data_spool, data_spool_each_rcpt
msgpart:body_replace – Streaming interface to a PCRE replacement of a message body part (minus headers) pattern, replacement msys.extended.message 4.0 data, data_spool, data_spool_each_rcpt
msgpart:content_type – Returns a table of content type related information msys.extended.message 4.0 data, data_spool, data_spool_each_rcpt
msgpart:header – Returns an array of headers values for the given name name msys.extended.message 4.0 data, data_spool, data_spool_each_rcpt
msgpart:header – Unset the header name of the current message part name, nil msys.extended.message 4.0 data, data_spool, data_spool_each_rcpt
msgpart:header – If mode is replace (or unspecified): first deletes all other headers of that name before appending the new value to the message headers name, value, [mode] msys.extended.message 4.0 data, data_spool, data_spool_each_rcpt
msgpart:insertAfter – Insert this part into the MIME tree after the given parameter after msys.extended.message 4.0 data, data_spool, data_spool_each_rcpt
msgpart:insertBefore – Insert this part into the MIME tree before the given parameter before msys.extended.message 4.0 data, data_spool, data_spool_each_rcpt
msgpart:raw_match – Streaming interface to PCRE search of the current message part pattern msys.extended.message 4.0 data, data_spool, data_spool_each_rcpt
msgpart:raw_replace – Streaming interface to PCRE replacement of message part content pattern, replacement msys.extended.message 4.0 data, data_spool, data_spool_each_rcpt
msgpart:text – Returns the transfer decoded text for the message part, in UTF-8 msys.extended.message 4.0 data, data_spool, data_spool_each_rcpt
msgpart:text – The entire message body part is replaced by the supplied text value, [type], [charset] msys.extended.message 4.0 data, data_spool, data_spool_each_rcpt
msgpart:text_match – Streaming PCRE search across the transfer-decoded UTF-8 text version of the message body part pattern msys.extended.message 4.0 data, data_spool, data_spool_each_rcpt
msgpart:text_replace – Streaming interface to a PCRE replacement of textual content from the message body parts. Only parts that have a ‘text’ mime type will be included in the search pattern, replacement msys.extended.message 4.0 data, data_spool, data_spool_each_rcpt
msgpart:unlink – Removes the part (and its children) from the MIME tree msys.extended.message 4.0 data, data_spool, data_spool_each_rcpt
msys.adaptive.registerRules – Register adaptive rules rules, [type] msys.adaptive 4.0 adaptive
msys.apn.apn_status_classifier – Determine whether the status code indicates a permanent or temporary failure status msys.apn 4.0 apn_response_eval, msg_dispose
msys.asyncOk – Returns true if the current execution environment is suitable for suspend/resume operation msys 4.0 any
msys.audit.connections – Returns the number of connections that have occurred for a CIDR block within a configured time window monitor, [options] msys.audit 4.0 any
msys.audit.inbound_session_count – Counts connections currently established from the specified cidr to the specified service cidr, servicename msys.audit 4.0 any
msys.audit.receptions – Returns the number of receptions that have occurred for a CIDR block within a configured time window monitor, [options] msys.audit 4.0 any
msys.audit.rejections – Returns the number of rejections that have occurred for a CIDR block within a configured time window monitor, [options] msys.audit 4.0 any
msys.audit_series.add – Adjusts the counter for the current time window of a named series name, [options] msys.audit_series 4.0 any
msys.audit_series.count – Returns the total associated with the named series name, [options] msys.audit_series 4.0 any
msys.audit_series.define – Define an audit series name, type, interval, num_windows, [options] msys.audit_series 4.0 init
msys.audit_series.remove_item – Removes a counter from a named series name, [key] msys.audit_series 4.0 any
msys.av.engines – Returns a list of configured engine names in a table msys.av 4.0 data, data_spool, data_spool_each_rcpt
msys.av.scan – This function performs a virus scan [av_engine_name], [msg], [validate_context] msys.av 4.0 data, data_spool, data_spool_each_rcpt
msys.av.scan_part – This function takes an optional msg (msys.core:_ec_message), an optional engine name and performs a virus scan on a specific part msg_part, [av_engine_name], [validate_context] msys.av 4.0 data, data_spool, data_spool_each_rcpt
msys.base64.decode – Decode a base64 encoded string encoded_text, [charset] msys.base64 4.0 any
msys.base64.encode – Base64-encode a string original, [fold], [charset] msys.base64 4.0 any
msys.bounce.classify – Create a bounce classification for a message msg msys.bounce 4.0 data, data_spool, data_spool_each_rcpt, set_binding
msys.bounce.classify_smtp_response – Create a bounce classification from SMTP response text and domain name response_text, domain msys.bounce 4.0 any
msys.brightmail.scan – Use Brightmail to scan messages msg, accept, vctx msys.brightmail 4.0 data, data_spool, data_spool_each_rcpt
msys.cast – Cast an object to the specified class object, classnamestring msys 4.0 any
msys.cidr.define – Define a named CIDR object name, options msys.cidr 4.0 init
msys.cidr.query – Look up address against the named CIDR name, [address] msys.cidr 4.0 any
msys.cidr.reload – Refreshes CIDRs of type ‘datasource’ and ‘rbldnsd’ name msys.cidr 4.0 any
msys.cloudmark.analyze – Analyze a message using Cloudmark hdr, [msg], [vctx] msys.cloudmark 4.0 data, data_spool, data_spool_each_rcpt
msys.cloudmark.score – Scan messages using Cloudmark [msg], [accept], [vctx] msys.cloudmark 4.0 data, data_spool, data_spool_each_rcpt
msys.commtouch.diagnose – Scan message using Commtouch [msg], [accept], [vctx] msys.commtouch 4.0 data, data_spool, data_spool_each_rcpt
msys.config – Set or get configuration values action, parameters msys 4.0 any
msys.core.dns_get_domain – Get a domain record domain msys.core 4.0 any
msys.core.get_now_ts – Get the current time msys.core 4.0 any
msys.core.io_wrapper_open – Open a handle to a resource filename, [options], [mode] msys.core 4.0 any
msys.core.mail_queue_delay_domain – Add a domain record to the delayed queue dr, note msys.core 4.0 any
msys.core.string_new – Create an ec_string data type msys.core 4.0 any
msys.counter.add – Add to the current value of the specified counter object_or_path, delta msys.counter 4.0 any
msys.counter.inc – Increment a counter object_or_path msys.counter 4.0 any
msys.counter.open – Create a counter object counter_path, [semantics] msys.counter 4.0 any
msys.counter.read – Read the specified counter object_or_path msys.counter 4.0 any
msys.counter.reset – Reset a counter object_or_path msys.counter 4.0 any
msys.counter.unlink – Unlink a counter counter_path msys.counter 4.0 any
msys.db.execute – Executes a query that is not expected to return data (such as an insert or an update query) cachename, query, [queryparams], [options] msys.db 4.0 any
msys.db.fetch_row – If successful, return the first row of the query result as a table cachename, query, [queryparams], [options] msys.db 4.0 any
msys.db.query – Query a datasource cachename, query, [queryparams], [options] msys.db 4.0 any
msys.delivery.ob_get_current_message – Get the current message from the session context sess msys.delivery 4.0 http_response_eval
msys.dnsLookup – Perform a DNS lookup name, [recordtype], [options] msys 4.0 any
msys.dumper.Dumper – Dump information about an object res msys.dumper 4.0 any
msys.expandMacro – Expand macros (such as sieve, spf and custom_logger macros) string msys 4.0 any
msys.expurgate.scan – Scan using the Eleven antivirus engine msg, accept, vctx msys.expurgate 4.0 data, data_spool, data_spool_each_rcpt
msys.gauge_cache.dec – Decrements the value associated with keystring in the named cache cachename, keystring msys.gauge_cache 4.0 any
msys.gauge_cache.define – Create a cache that can be used to maintain a set of counters name, maxelems, ttl, [replicated] msys.gauge_cache 4.0 any
msys.gauge_cache.get – Looks up the value associated with keystring in the named cache cachename, keystring msys.gauge_cache 4.0 any
msys.gauge_cache.inc – Increments the value associated with keystring in the named cache cachename, keystring msys.gauge_cache 4.0 any
msys.gauge_cache.remove_item – Removes the value associated with keystring from the named cache cachename, keystring msys.gauge_cache 4.0 any
msys.gcm.gcm_classify_error – Determine the delivery status of the "DLV_Response_Status" variable status msys.gcm 4.0 gcm_response_eval, http_response_eval, msg_dispose
msys.gcm.gcm_get_result_error_code – Get the error code from the response results error error msys.gcm 4.0 gcm_response_eval, http_response_eval, msg_dispose
msys.getClassMetaTable – Returns the metatable for the named class classnamestring msys 4.0 any
msys.http.client.new – Create an HTTP client msys.http.client 4.0 any
msys.httpclnt.http_status_classifier – Determine the delivery status of the "DLV_Response_Status" variable status msys.httpclnt 4.0 http_response_eval
msys.httpsrv.register – Register a Lua function as an HTTP endpoint 4.0
msys.idn.to_idn – Attempts to convert the domain to the IDN format name msys.idn 4.2 any
msys.idn.to_utf8 – Converts an IDN formatted string to unicode name msys.idn 4.2 any
msys.lock – The current running OS level thread obtains a lock on the named mutex mutexname msys 4.0 any
msys.mstore.load – Retrieve a message from Riak data storage bucket_id, msgid msys.mstore 4.0 SMPP
msys.os.statvfs_read – Request a snapshot of the stream path msys.os 4.0 any
msys.os.statvfs_subscribe – Provide a "stream" for statvfs updates path, interval msys.os 4.0 any
msys.parseRFC2822Addresses – Parse the address string per the address parsing rules defined in RFC2822 addressstring, component msys 4.0 data, data_spool, data_spool_each_rcpt
msys.pcre.match – Perform a PCRE regex match operation str, pattern msys.pcre 4.0 any
msys.pcre.replace – Perform a PCRE replace operation subject, pattern, replacement msys.pcre 4.0 any
msys.pcre.split – Perform a PCRE split operation subject, pattern msys.pcre 4.0 any
msys.qp.decode – Decode a quoted-printable message encoded_txt, [charset] msys.qp 4.0 any
msys.qp.encode – Quoted-printable encode a string original, [charset], [dotstuffing] msys.qp 4.0 any
msys.readfile – Read the entire contents of the specified file or URI filename_or_uri msys 4.0 any
msys.registerAuth – Register an authentication/authorization scheme that can be used for SMTP or control channel authentication schemename, authtable msys 4.0 init
msys.registerControl – Register a command with the control channel subsystem prefix, closure msys 4.0 init
msys.registerModule – Registers a Lua module with the system name, functable msys 4.0 any
msys.rfc3464.compute_delivery_status – Generate RFC3464 compliant delivery status headers msg, action msys.rfc3464 4.0 any
msys.rfc3464.compute_delivery_status_string – Generate RFC3464 compliant delivery status headers response_text msys.rfc3464 4.0 any
msys.rfc3464.create_mdn – Generate an MDN from a message msg, action msys.rfc3464 4.0 any
msys.rfc3464.extract_delivery_status – Return a table of parsed email headers msg msys.rfc3464 4.0 any
msys.rfc3464.send_mdn – Generate and enqueue an MDN msg, action msys.rfc3464 4.0 any
msys.runInPool – Run a function in a separate threadpool pool, closure, […] msys 4.0 any
msys.sleep – When called in the scheduler thread, suspend the current session for the specified duration duration_in_seconds msys 4.0 any
msys.snmpTrap – Issue an SNMP trap traptable msys 4.0 any
msys.symantec_beik.scan – Scan using BEIK msg, vctx msys.symantec_beik 4.0 data, data_spool, data_spool_each_rcpt
msys.threadpool.count – Returns the current number of thread pools msys.threadpool 4.0 any
msys.threadpool.find – Finds a thread pool name from a job class ID or a job class ID from a thread pool name [threadpoolname], [jobclassID] msys.threadpool 4.0 any
msys.threadpool.stat – Return stats regarding a threadpool [threadpoolname], [jobclassID] msys.threadpool 4.0 any
msys.timer.after – Execute closure after a given length of time delta, closure, [name] msys.timer 4.0 any
msys.timer.at – Execute closure at a given time number, closure, [name] msys.timer 4.0 any
msys.timer.every – Execute closure every interval interval, closure, [name] msys.timer 4.0 any
msys.type – Return the type name of the supplied parameter parameter msys 4.0 any
msys.unlock – Releases a lock obtained via msys.lock mutexname msys 4.0 any
msys.validate.dk.get_responsible_domain – This function requires module "dk_validate". "msg" is a mail message. "ctx" is the validation context. It returns the responsible domain for the current message msg, ctx msys.validate.dk 4.0 data, data_spool, data_spool_each_rcpt
msys.validate.dk.sign – Sign a message using a Domain Key msg, ctx, options msys.validate.dk 4.0 core_data_validation
msys.validate.opendkim.get_num_sigs – Return the number of DKIM signatures dkim msys.validate.opendkim 4.0 data, data_spool, data_spool_each_rcpt
msys.validate.opendkim.get_sig – Get a signature from a DKIM object dkim, [num] msys.validate.opendkim 4.0 data, data_spool, data_spool_each_rcpt
msys.validate.opendkim.get_sig_canons – Fetch the canonicalizers used for a DKIM signature dkim_sig msys.validate.opendkim 4.0 data, data_spool, data_spool_each_rcpt
msys.validate.opendkim.get_sig_domain – Fetch the signing domain from a DKIM_SIGINFO object dkim_sig msys.validate.opendkim 4.0 data, data_spool, data_spool_each_rcpt
msys.validate.opendkim.get_sig_errorstr – Fetch the error associated with a DKIM signature dkim_sig msys.validate.opendkim 4.0 data, data_spool, data_spool_each_rcpt
msys.validate.opendkim.get_sig_flags – Fetch the flags associated with a DKIM signature dkim_sig msys.validate.opendkim 4.0 data, data_spool, data_spool_each_rcpt
msys.validate.opendkim.get_sig_hdrsigned – Determine whether a given header was signed dkim_sig, header_name msys.validate.opendkim 4.0 data, data_spool, data_spool_each_rcpt
msys.validate.opendkim.get_sig_identity – Fetch the identity associated with a DKIM signature dkim, dkim_sig msys.validate.opendkim 4.0 data, data_spool, data_spool_each_rcpt
msys.validate.opendkim.get_sig_keysize – Fetch the size of the key used to generate a DKIM signature dkim_sig msys.validate.opendkim 4.0 data, data_spool, data_spool_each_rcpt
msys.validate.opendkim.get_sig_selector – Fetch the selector associated with a DKIM signature dkim_sig msys.validate.opendkim 4.0 data, data_spool, data_spool_each_rcpt
msys.validate.opendkim.get_sig_signalg – Return the signing algorithm as a string dkim_sig msys.validate.opendkim 4.0 data, data_spool, data_spool_each_rcpt
msys.validate.opendkim.sign – Sign a message using OpenDKIM msg, vctx, [options] msys.validate.opendkim 4.0 core_final_validation
msys.validate.opendkim.verify – Verify an DKIM signature m msys.validate.opendkim 4.0 data, data_spool, data_spool_each_rcpt
sess:request_add_header – Set the header of an HTTP session header, value, replace msys.httpclnt 4.0 http_request_eval
sess:request_delete_header – Delete a header from an HTTP session header msys.httpclnt 4.0 http_request_eval
sess:request_finalize – Finalize changes to an HTTP request update msys.httpclnt 4.0 http_request_eval
sess:request_set_body – Set the body of an HTTP session request msys.httpclnt 4.0 http_request_eval
session:request_url_get – Get the request URL 4.0
session:response_status_set_std – Set the HTTP status for the session response 4.0
thread.mutex – Create a new mutex [type] thread 4.0 any
vctx:add_recipient – Adds address (which may be a table representing multiple addresses) to the recipient list for the inbound session address msys.extended.vctx 4.0 data, data_spool, data_spool_each_rcpt, rcptto
vctx:disconnect – Disconnect the current session [code], [message] msys.core 4.0 any
vctx:get – Get the value of a context variable type, key msys.core 4.0 any
vctx:recipient_list – Return or set the current recipient list [addresses] msys.extended.vctx 4.0
vctx:remove_recipient – Removes an address (which may be a table representing multiple addresses) from the recipient list address msys.extended.vctx 4.0 data, data_spool, data_spool_each_rcpt, mailfrom, rcptto
vctx:set – Set the value of a context variable type, key, value msys.core 4.0 any
vctx:set_code – Sets the inbound disposition and response message codenum, message msys.core 4.0 any
vctx:tarpit – Issues a time cost on the inbound session, if supported by the listener (currently only SMTP supports this) interval msys.extended.vctx 4.0 connect