### Get All HTML Templates Source: https://context7.com/dashamail/php_dashamail/llms.txt Fetches all saved HTML templates for the user. No parameters are needed to retrieve all templates. ```php campaigns_get_templates(); ``` -------------------------------- ### Automate Email Marketing Workflow with PHPDasha Source: https://context7.com/dashamail/php_dashamail/llms.txt A comprehensive example showing the full lifecycle of an email campaign, from list creation to subscriber management and performance reporting. ```php lists_add('Клиенты интернет-магазина', array( 'company' => 'ООО Мой Магазин', 'abuse_email' => 'admin@myshop.ru' )); $listId = $listResult['list_id']; // 2. Добавляем подписчиков $subscribers = array( array('email' => 'user1@example.com', 'name' => 'Иван'), array('email' => 'user2@example.com', 'name' => 'Мария'), array('email' => 'user3@example.com', 'name' => 'Пётр') ); foreach ($subscribers as $sub) { $dasha->lists_add_member($listId, $sub['email'], array( 'merge_1' => $sub['name'] )); } // 3. Создаём рассылку $campaignResult = $dasha->campaigns_create(array($listId), array( 'name' => 'Летняя распродажа', 'subject' => 'Скидки до 70% только сегодня!', 'from_name' => 'Мой Магазин', 'from_email' => 'news@myshop.ru', 'html' => '

Здравствуйте, [merge_1]!

Только сегодня скидки до 70%!

Отписаться от рассылки ' )); $campaignId = $campaignResult['campaign_id']; // 4. Получаем статистику после отправки $summary = $dasha->reports_summary($campaignId); echo "Отправлено: " . $summary['sent'] . "\n"; echo "Доставлено: " . $summary['delivered'] . "\n"; echo "Открыто: " . $summary['opened'] . "\n"; } catch (Exception $e) { echo "Ошибка: " . $e->getMessage(); } ``` -------------------------------- ### Get Campaign Attachments Source: https://context7.com/dashamail/php_dashamail/llms.txt Retrieves a list of all files attached to a specific campaign. The campaign ID is required. ```php campaigns_get_attachments('54321'); print_r($attachments); // Результат: массив с информацией о прикреплённых файлах ``` -------------------------------- ### Get Campaign Summary Statistics Source: https://context7.com/dashamail/php_dashamail/llms.txt Retrieves a summary of statistics for a campaign, including total sent, delivered, opened, and clicked counts. ```php reports_summary('54321'); print_r($summary); // Результат: общее количество отправленных, доставленных, открытых, кликов и т.д. ``` -------------------------------- ### Get Delivered Emails List Source: https://context7.com/dashamail/php_dashamail/llms.txt Fetches a list of emails that were successfully delivered. Parameters for pagination and limiting results are supported. ```php 0, 'limit' => 50 ); $delivered = $dasha->reports_delivered('54321', $params); print_r($delivered); ``` -------------------------------- ### Get Unsubscribed List Source: https://context7.com/dashamail/php_dashamail/llms.txt Returns a list of subscribers who have unsubscribed after receiving a campaign. Requires the campaign ID. ```php reports_unsubscribed('54321'); print_r($unsubscribed); ``` -------------------------------- ### Get Bounced Emails List Source: https://context7.com/dashamail/php_dashamail/llms.txt Fetches a list of emails that could not be delivered (bounced). Requires the campaign ID. ```php reports_bounced('54321'); print_r($bounced); ``` -------------------------------- ### Get Client Statistics Source: https://context7.com/dashamail/php_dashamail/llms.txt Provides statistics on the email clients, operating systems, and browsers used by recipients. Useful for understanding user environments. ```php reports_clients('54321'); print_r($clientStats); // Результат: распределение открытий по почтовым клиентам и устройствам ``` -------------------------------- ### Get Opened Emails List Source: https://context7.com/dashamail/php_dashamail/llms.txt Retrieves a list of emails that have been opened by recipients. Supports pagination and limiting results. ```php 0, 'limit' => 50 ); $opened = $dasha->reports_opened('54321', $params); print_r($opened); ``` -------------------------------- ### Get Click Statistics Source: https://context7.com/dashamail/php_dashamail/llms.txt Provides statistics on link clicks within an email campaign. Returns an array of URLs and their corresponding click counts. ```php reports_clickstat('54321'); print_r($clickStats); // Результат: массив с URL и количеством кликов по каждой ссылке ``` -------------------------------- ### Get Sent Emails List Source: https://context7.com/dashamail/php_dashamail/llms.txt Retrieves a list of all emails sent within a campaign. Supports pagination, limiting results, and ordering. ```php 0, 'limit' => 100, 'order' => 'desc' ); $sentEmails = $dasha->reports_sent('54321', $params); print_r($sentEmails); ``` -------------------------------- ### Get Bounce Statistics Source: https://context7.com/dashamail/php_dashamail/llms.txt Returns detailed statistics on the reasons for email delivery failures (bounces). Provides a breakdown by bounce type (e.g., hard, soft). ```php reports_bouncestat('54321'); print_r($bounceStats); // Результат: статистика по типам bounce (hard, soft и т.д.) ``` -------------------------------- ### Get Specific HTML Template Source: https://context7.com/dashamail/php_dashamail/llms.txt Retrieves a specific HTML template by its ID. An array containing the template ID must be passed as a parameter. ```php // Получить конкретный шаблон $params = array('id' => '100'); $template = $dasha->campaigns_get_templates($params); print_r($template); ``` -------------------------------- ### Get Geo Statistics Source: https://context7.com/dashamail/php_dashamail/llms.txt Returns geographical statistics on email opens, broken down by region and country. Helps in understanding the geographic distribution of recipients. ```php reports_geo('54321'); print_r($geoStats); // Результат: распределение открытий по географическим регионам ``` -------------------------------- ### Initialize PHPDasha and Validate Email Source: https://context7.com/dashamail/php_dashamail/llms.txt Create a new instance of the PHPDasha class using your credentials and perform email validation. ```php checkEmail('test@example.com'); if ($validEmail !== false) { echo "Проверенный email: " . $validEmail; } else { echo "Email некорректен"; } ``` -------------------------------- ### Create Campaigns Source: https://context7.com/dashamail/php_dashamail/llms.txt Methods for creating standard email campaigns or automated trigger-based campaigns. ```php 'Новогодняя распродажа', 'subject' => 'Скидки до 50% на всё!', 'from_name' => 'Интернет-магазин', 'from_email' => 'news@myshop.ru', 'html' => '

Привет!

Наши акции...

Отписаться', 'plain_text' => 'Привет! Наши акции... Отписаться: [unsubscribe]' ); $result = $dasha->campaigns_create($list_ids, $params); print_r($result); // Результат содержит campaign_id созданной рассылки ``` ```php array('12345'), 'name' => 'Приветственное письмо', 'subject' => 'Добро пожаловать!', 'from_name' => 'Компания', 'from_email' => 'welcome@company.ru', 'html' => '

Добро пожаловать!

Отписаться', 'event' => 'subscribe' // Событие-триггер ); $result = $dasha->campaigns_create_auto($params); print_r($result); ``` -------------------------------- ### campaigns_create Source: https://context7.com/dashamail/php_dashamail/llms.txt Creates a new email campaign for specified address lists. ```APIDOC ## campaigns_create ### Description Creates a new email campaign for specified address lists. ### Parameters - **list_ids** (array) - Required - Array of address list IDs - **params** (array) - Required - Campaign details including 'name', 'subject', 'from_name', 'from_email', 'html', and 'plain_text' ``` -------------------------------- ### Add HTML Template Source: https://context7.com/dashamail/php_dashamail/llms.txt Saves a new HTML template for future use. Requires a name for the template and its HTML content. ```php

{{title}}

{{content}}

Отписаться '; $result = $dasha->campaigns_add_template('Базовый шаблон', $templateHtml); print_r($result); ``` -------------------------------- ### Attach File to Campaign Source: https://context7.com/dashamail/php_dashamail/llms.txt Use this method to attach a file to a campaign by providing its URL. An optional array of parameters, such as the file name, can be included. ```php 'Прайс-лист.pdf' ); $result = $dasha->campaigns_attach('54321', 'https://mysite.ru/files/pricelist.pdf', $params); print_r($result); ``` -------------------------------- ### Import Subscribers from CSV Source: https://context7.com/dashamail/php_dashamail/llms.txt Imports subscribers from a CSV file into a specified address list. ```php 'Имя', 'merge_2' => 'Фамилия', 'type' => 'copy', // copy или rewrite 'update' => 'yes' ); $result = $dasha->lists_upload('12345', '/path/to/subscribers.csv', 'email', $params); print_r($result); ``` -------------------------------- ### Manage Address Lists Source: https://context7.com/dashamail/php_dashamail/llms.txt Methods for retrieving, creating, updating, and deleting subscriber lists. ```php lists_get(); print_r($allLists); // Результат: массив с данными всех баз // Получить конкретную базу по ID $specificList = $dasha->lists_get('12345'); print_r($specificList); ``` ```php lists_add('Новые подписчики'); // Создание базы с расширенными параметрами $params = array( 'abuse_email' => 'abuse@mycompany.ru', 'abuse_name' => 'Администратор', 'company' => 'ООО Моя Компания' ); $result = $dasha->lists_add('Клиенты 2024', $params); print_r($result); ``` ```php 'Обновлённое название базы', 'abuse_email' => 'new-abuse@mycompany.ru', 'company' => 'Новое название компании' ); $result = $dasha->lists_update('12345', $params); print_r($result); ``` ```php lists_delete('12345'); if ($result) { echo "База успешно удалена"; } ``` -------------------------------- ### lists_upload Source: https://context7.com/dashamail/php_dashamail/llms.txt Imports subscribers from a CSV file into an address list. ```APIDOC ## lists_upload ### Description Imports subscribers from a CSV file into an address list. ### Parameters - **list_id** (string) - Required - ID of the address list - **file_path** (string) - Required - Path to the CSV file - **key_field** (string) - Required - The field used as a unique identifier (e.g., 'email') - **params** (array) - Optional - Additional settings including merge fields, import type ('copy' or 'rewrite'), and update flag ``` -------------------------------- ### Retrieve Campaigns Source: https://context7.com/dashamail/php_dashamail/llms.txt Fetches a list of campaigns with optional filtering by status, list ID, or type. ```php campaigns_get(); // Получить рассылки с фильтрами $params = array( 'status' => 'sent', // draft, scheduled, sending, sent 'list_id' => '12345', 'type' => 'regular' // regular, auto ); $campaigns = $dasha->campaigns_get($params); print_r($campaigns); ``` -------------------------------- ### Manage Subscribers Source: https://context7.com/dashamail/php_dashamail/llms.txt Methods for retrieving, adding, updating, deleting, and unsubscribing members from lists. ```php lists_get_members('12345'); // Получить подписчиков с фильтрами и пагинацией $params = array( 'state' => 'active', // active, unsubscribed, bounced 'start' => 0, 'limit' => 100 ); $members = $dasha->lists_get_members('12345', $params); print_r($members); ``` ```php lists_add_member('12345', 'subscriber@example.com'); // Добавление с дополнительными полями $params = array( 'merge_1' => 'Иван', // Имя 'merge_2' => 'Петров', // Фамилия 'merge_3' => '+7999123456', // Телефон 'update' => 'yes' // Обновить если существует ); $result = $dasha->lists_add_member('12345', 'subscriber@example.com', $params); print_r($result); ``` ```php 'Новое Имя', 'merge_2' => 'Новая Фамилия' ); $result = $dasha->lists_update_member('987654', $params); print_r($result); ``` ```php lists_delete_member('987654'); if ($result) { echo "Подписчик удалён"; } ``` ```php lists_unsubscribe_member(array('member_id' => '987654')); // Отписка по email и list_id $result = $dasha->lists_unsubscribe_member(array( 'email' => 'subscriber@example.com', 'list_id' => '12345' )); print_r($result); ``` -------------------------------- ### Manage Custom Fields Source: https://context7.com/dashamail/php_dashamail/llms.txt Operations for adding, updating, or deleting custom fields in an address list. ```php 'Город', 'choices' => 'Москва,Санкт-Петербург,Казань' // для типа dropdown ); $result = $dasha->lists_add_merge('12345', 'text', $params); // Типы полей: text, dropdown, date, number print_r($result); ``` ```php 'Новое название поля', 'choices' => 'Вариант1,Вариант2,Вариант3' ); $result = $dasha->lists_update_merge('12345', '5', $params); print_r($result); ``` ```php lists_delete_merge('12345', '5'); print_r($result); ``` -------------------------------- ### Campaign Templates API Source: https://context7.com/dashamail/php_dashamail/llms.txt Methods for creating, retrieving, and deleting HTML email templates. ```APIDOC ## campaigns_get_templates ### Description Retrieves saved HTML templates. Can fetch all or a specific template by ID. ### Parameters - **params** (array) - Optional - Filter parameters like 'id'. ## campaigns_add_template ### Description Saves a new HTML template for reuse. ### Parameters - **name** (string) - Required - Name of the template. - **html** (string) - Required - HTML content of the template. ## campaigns_delete_template ### Description Deletes a saved HTML template. ### Parameters - **id** (string) - Required - The ID of the template to delete. ``` -------------------------------- ### Update Campaigns Source: https://context7.com/dashamail/php_dashamail/llms.txt Updates parameters for existing standard or automated campaigns. ```php 'Новый заголовок письма', 'html' => '

Обновлённый контент

Отписаться', 'send_date' => '2024-12-25 10:00:00' ); $result = $dasha->campaigns_update('54321', $params); print_r($result); ``` ```php array('12345', '67890'), 'subject' => 'Обновлённое приветствие', 'delay' => '60' // Задержка в минутах ); $result = $dasha->campaigns_update_auto('54321', $params); print_r($result); ``` -------------------------------- ### Delete and Trigger Campaigns Source: https://context7.com/dashamail/php_dashamail/llms.txt Methods for deleting campaigns or manually triggering an automated campaign for a specific user. ```php campaigns_delete('54321'); if ($result) { echo "Рассылка удалена"; } ``` ```php '0' // Отправить сразу, без задержки ); $result = $dasha->campaigns_force_auto('54321', 'user@example.com', $params); print_r($result); ``` -------------------------------- ### Campaign Reports API Source: https://context7.com/dashamail/php_dashamail/llms.txt Methods for retrieving detailed statistics and delivery reports for email campaigns. ```APIDOC ## reports_sent / reports_delivered / reports_opened ### Description Retrieves lists of sent, delivered, or opened emails for a campaign. ### Parameters - **campaign_id** (string) - Required - **params** (array) - Optional - Pagination and sorting parameters (start, limit, order). ## reports_unsubscribed / reports_bounced ### Description Retrieves lists of unsubscribed users or bounced emails. ### Parameters - **campaign_id** (string) - Required ## reports_clickstat / reports_bouncestat / reports_summary / reports_clients / reports_geo ### Description Retrieves various analytical reports including click statistics, bounce reasons, summary, client/device info, and geographic data. ### Parameters - **campaign_id** (string) - Required ``` -------------------------------- ### Campaign Attachments API Source: https://context7.com/dashamail/php_dashamail/llms.txt Methods for managing file attachments within email campaigns. ```APIDOC ## campaigns_attach ### Description Attaches a file to a campaign by URL. ### Parameters - **campaign_id** (string) - Required - The ID of the campaign. - **url** (string) - Required - The URL of the file to attach. - **params** (array) - Optional - Additional parameters like 'name'. ## campaigns_get_attachments ### Description Retrieves a list of files attached to a specific campaign. ### Parameters - **campaign_id** (string) - Required - The ID of the campaign. ## campaigns_delete_attachments ### Description Removes an attached file from a campaign. ### Parameters - **campaign_id** (string) - Required - The ID of the campaign. - **attachment_id** (string) - Required - The ID of the attachment to delete. ``` -------------------------------- ### Address List Management Source: https://context7.com/dashamail/php_dashamail/llms.txt Endpoints for managing mailing lists including retrieval, creation, updating, and deletion. ```APIDOC ## lists_get ### Description Retrieves all mailing lists or a specific list by ID. ### Parameters #### Query Parameters - **list_id** (string) - Optional - The ID of the specific mailing list to retrieve. ### Response #### Success Response (200) - **data** (array) - Returns an array of mailing list objects or a single list object. --- ## lists_add ### Description Creates a new mailing list. ### Parameters #### Request Body - **name** (string) - Required - Name of the new mailing list. - **params** (array) - Optional - Additional contact info (abuse_email, abuse_name, company). --- ## lists_update ### Description Updates contact information and settings for an existing mailing list. ### Parameters #### Path Parameters - **list_id** (string) - Required - The ID of the list to update. #### Request Body - **params** (array) - Required - Associative array of fields to update (name, abuse_email, company). --- ## lists_delete ### Description Deletes a mailing list and all active subscribers within it. ### Parameters #### Path Parameters - **list_id** (string) - Required - The ID of the list to delete. ``` -------------------------------- ### Subscriber Management Source: https://context7.com/dashamail/php_dashamail/llms.txt Endpoints for managing subscribers within mailing lists, including adding, updating, deleting, and unsubscribing. ```APIDOC ## lists_get_members ### Description Retrieves subscribers from a mailing list with optional filtering and pagination. ### Parameters #### Path Parameters - **list_id** (string) - Required - The ID of the mailing list. #### Query Parameters - **params** (array) - Optional - Filter options (state: active/unsubscribed/bounced, start, limit). --- ## lists_add_member ### Description Adds a new subscriber to a mailing list. ### Parameters #### Path Parameters - **list_id** (string) - Required - The ID of the mailing list. - **email** (string) - Required - Subscriber email address. #### Request Body - **params** (array) - Optional - Additional fields (merge_1, merge_2, merge_3, update). --- ## lists_update_member ### Description Updates data for an existing subscriber. ### Parameters #### Path Parameters - **member_id** (string) - Required - The ID of the subscriber. #### Request Body - **params** (array) - Required - Fields to update. --- ## lists_delete_member ### Description Removes a subscriber from a mailing list. ### Parameters #### Path Parameters - **member_id** (string) - Required - The ID of the subscriber. --- ## lists_unsubscribe_member ### Description Unsubscribes a user from mailing lists while retaining their data. ### Parameters #### Request Body - **params** (array) - Required - Either ['member_id' => '...'] or ['email' => '...', 'list_id' => '...'] ``` -------------------------------- ### Move or Copy Subscriber Source: https://context7.com/dashamail/php_dashamail/llms.txt Methods for transferring or duplicating a subscriber between address lists. ```php lists_move_member('987654', '67890'); print_r($result); ``` ```php lists_copy_member('987654', '67890'); print_r($result); ``` -------------------------------- ### lists_move_member Source: https://context7.com/dashamail/php_dashamail/llms.txt Moves a subscriber from one address list to another. ```APIDOC ## lists_move_member ### Description Moves a subscriber from one address list to another. ### Parameters - **member_id** (string) - Required - ID of the subscriber to move - **list_id** (string) - Required - ID of the destination address list ``` -------------------------------- ### lists_copy_member Source: https://context7.com/dashamail/php_dashamail/llms.txt Copies a subscriber to another address list while keeping them in the original list. ```APIDOC ## lists_copy_member ### Description Copies a subscriber to another address list while keeping them in the original list. ### Parameters - **member_id** (string) - Required - ID of the subscriber to copy - **list_id** (string) - Required - ID of the destination address list ``` -------------------------------- ### Delete HTML Template Source: https://context7.com/dashamail/php_dashamail/llms.txt Removes a saved HTML template. The ID of the template to be deleted is required. ```php campaigns_delete_template('100'); print_r($result); ``` -------------------------------- ### lists_add_merge Source: https://context7.com/dashamail/php_dashamail/llms.txt Adds a new custom field to the address list structure. ```APIDOC ## lists_add_merge ### Description Adds a new custom field to the address list structure. ### Parameters - **list_id** (string) - Required - ID of the address list - **type** (string) - Required - Field type: 'text', 'dropdown', 'date', or 'number' - **params** (array) - Optional - Field configuration (e.g., 'title', 'choices') ``` -------------------------------- ### campaigns_delete Source: https://context7.com/dashamail/php_dashamail/llms.txt Deletes a campaign by its ID. ```APIDOC ## campaigns_delete ### Description Deletes a campaign by its ID. ### Parameters - **campaign_id** (string) - Required - ID of the campaign to delete ``` -------------------------------- ### Delete Campaign Attachment Source: https://context7.com/dashamail/php_dashamail/llms.txt Removes a specific file attachment from a campaign. Requires both the campaign ID and the attachment ID. ```php campaigns_delete_attachments('54321', '789'); // campaign_id, attachment_id print_r($result); ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.