mailing_send_test
php
mixed mailing_send_test(string $email_testowy, array $params)Sends a test mailing to $email_testowy. Pass all required mailing settings in an array as the second argument.
Returns false on failure.
The parameter array uses the following required keys:
- newsletter - ID of an existing newsletter in SARE;
- subject - Subject field of the mailing. Empty by default;
- encoding - newsletter encoding. Must be supported by SARE (e.g. UTF-8, ISO-8859-2). Defaults to UTF-8;
- attached_images - send with attached images rather than images hosted on the server when true (or a value that converts to boolean true, e.g. 1). Defaults to false;
- from - From (sender) field of the mailing. Must follow this format:
The sender name must be enclosed in double quotes (not single quotes) and separated from the email address by whitespace, such as a space. If omitting the sender name, omit the quotes as well. The email address must be enclosed in < and >. If from is missing from the parameter array or has an invalid format, the mailing uses the default From value configured in SARE preferences.
- replyto - Reply-To field of the mailing. Must be a syntactically valid email address. Not set by default;
- use_name - set to true (or a value that converts to boolean true, e.g. 1) to use the Name field as the recipient name alongside the email address in the To field. Set to false (or a value that converts to boolean false, e.g. 0) to omit the Name field. If use_name is missing from the parameter array, the “Use the Name field as the recipient” setting in SARE preferences is used.
- format - message format. Defaults to txt,html. Set to txt to send only the plain-text part;
- format_txt - message format for recipients marked as accepting plain-text messages only. Defaults to txt. Set to html,txt to send both the HTML and plain-text parts;
- trace_openings - set to numeric 0 or false to disable newsletter open tracking. Any other value (or omitting the field) keeps the default behavior of including tracking code in the newsletter;
- trace_clicks - set to numeric 0 or false to disable link click tracking and leave original links unchanged. Any other value (or omitting the field) keeps click tracking enabled by default;
Example:
php
$parametry["newsletter"] = 6;
$parametry["subject"] = "Subject";
$parametry["from"] = '"Redakcja newslettera" <newsletter@sare.pl>';
$mailing = mailing_send_test("test@sare.pl", $parametry);