Sailthru_Client::send PHP Method

send() public method

If you pass the $schedule_time parameter, the send will be scheduled for a future time. Options: replyto: override Reply-To header test: send as test email (subject line will be marked, will not count towards stats)
public send ( string $template, string $email, array $vars = [], array $options = [], string $schedule_time = null ) : array
$template string
$email string
$vars array
$options array
$schedule_time string
return array API result
    public function send($template, $email, $vars = [], $options = [], $schedule_time = null)
    {
        $post = [];
        $post['template'] = $template;
        $post['email'] = $email;
        $post['vars'] = $vars;
        $post['options'] = $options;
        if ($schedule_time) {
            $post['schedule_time'] = $schedule_time;
        }
        $result = $this->apiPost('send', $post);
        return $result;
    }

Usage Example

            } else {
                require_once 'client/requires.php';
                $client = new Sailthru_Client(get_option('sailthru_api_key'), get_option('sailthru_secret'));
                $replacement_fields = array();
                if (isset($_POST['fname'])) {
                    $replacement_fields['first_name'] = $_POST['fname'];
                }
                if (isset($_POST['lname'])) {
                    $replacement_fields['last_name'] = $_POST['lname'];
                }
                $all_lists = $form->get_all_lists();
                $lists = array();
                if ($has_lists) {
                    foreach ($all_lists as $id => $list_name) {
                        if (in_array($id, $_POST['lists'])) {
                            $lists[$list_name] = '1';
                        }
                    }
                }
                $client->setEmail($_POST['email'], $replacement_fields, $lists);
                if ((bool) get_option('sailthru_welcome') && ($template = get_option('sailthru_welcome_template'))) {
                    require_once 'client/requires.php';
                    $client = new Sailthru_Client(get_option('sailthru_api_key'), get_option('sailthru_secret'));
                    $r = $client->send($template, $_POST['email'], $replacement_fields, array());
                }
                echo '{}';
            }
        }
        break;
}
die;
All Usage Examples Of Sailthru_Client::send