Skip to content

mailing_send ​

php
string mailing_send(array $params , [number $kiedy])

Sends a mailing. Pass all required mailing settings in an array as the first argument.

The optional $kiedy parameter schedules delayed sending. Provide the time as a timestamp (e.g. from time()). To send the mailing in one hour, add 3600 seconds to the value returned by time() (see the example).

Returns false on failure. The parameter array uses the following required keys:

  • newsletter - ID of an existing newsletter in SARE;
  • groups - array containing the group ID or comma-separated group IDs from the SARE account to send the mailing to;
You can also use the optional fields described for mailing_send_test(), as well as:
  • campaign - name or ID of the campaign to assign the mailing to;
  • filterSQL - SQL filter ID;
  • filterSS - SAREscript filter ID;
  • ga_utm_source - Google Analytics utm_source parameter;
  • ga_utm_medium - Google Analytics utm_medium parameter;
  • ga_utm_campaign - Google Analytics utm_campaign parameter;
NOTE: This function does not work in an email address context (where an email address is required; see Appendix B). It returns false in that context.

Example:

php
$parametry["newsletter"] = 6;
$parametry["subject"] = "Subject";
$parametry["from"] = '"Redakcja newslettera" <newsletter@sare.pl>';
$parametry["groups"] = array(1);
mailing_send_test("test@sare.pl", $parametry);
mailing_send($parametry, time()+3600);