adebayo27/tribearcmail

tribearc mail api 的邮件和短信发送包装器

v1.0.1 2022-09-27 09:11 UTC

This package is auto-updated.

Last update: 2024-09-29 06:14:55 UTC


README

tribearc mail api 的邮件和短信发送包装器

安装

使用 composer 安装 adebayo27/tribearcmail

用法

将以下内容添加到 .env 文件中

TRIBEARC_MAIL_API_KEY="从 tribearc mail 获取的 api 密钥"
TRIBEARC_MAIL_FROM_NAME="您的发件人姓名"
TRIBEARC_MAIL_FROM_EMAIL="您的发件人邮箱"
TRIBEARC_MAIL_REPLY_TO="您的回复邮箱"
TRIBEARC_MAIL_BUSINESS_ADDRESS="您的商业地址(已在 tribe 注册)"
TRIBEARC_MAIL_BUSINESS_NAME="您的商业名称(已在 tribe 注册)"

示例:使用库

<?php

use Adebayo27\Tribearcmail\TribearcMail;

$tribearc = new TribearcMail();

//send transactional email 
$response = $tribearc->tribearcSendMail('Subject', 'Email body', 'email address');

//send bulk email
$response = $tribearc->tribearcSendBulkMail('Subject', 'Email body', 'ade@mail.com,bayo@mail.com,koya@mail');


//send instant sms 
$response = $tribearc->tribearcSMSInstant(
    [
        "from" => "Kent",
        "to" => "+2348012345678",
        "message" => "Hello Adebayo",
    ]
);

//check sms balance
$response = $tribearc->tribearcCheckSMSBalance();

//check from email status
$response = $tribearc->tribearcCheckFromEmailStatus('hello@adebayo.com');

//send email to saved list
$response = $tribearc->tribearcSendEmailToSavedList(
    [        
        'title' => 'Campaign',
        'subject' => 'subject',
        'html_text' => 'Hello',
        'plain_text' => '', //optional
        'list_ids' => 'your list ids', //Required only if you set send_campaign to 1 and no segment_ids are passed in. List IDs should be single or comma-separated. The encrypted & hashed ids can be found under View all lists section named ID.
        'exclude_list_ids' => '', //Lists to exclude from your campaign. List IDs should be single or comma-separated. The encrypted & hashed ids can be found under View all lists section named ID. (optional)
        'track_opens' => '1', //Set to 0 to disable, 1 to enable and 2 for anonymous opens tracking.
        'query_string' => '', //eg. Google Analytics tags (optional)
        'brand_id' => '', //Required only if you are creating a 'Draft' campaign (send_campaign set to 0 or left as default). Brand IDs can be found under 'Brands' page named ID
        'track_clicks' => '1', //Set to 0 to disable, 1 to enable and 2 for anonymous opens tracking.
        'send_campaign' => '1', //Set to 1 if you want to send the campaign as well and not just create a draft. Default is 0.
        'segment_ids' => '', //Required only if you set send_campaign to 1 and no list_ids are passed in. Segment IDs should be single or comma-separated. Segment ids can be found in the segments setup page.
        'schedule_date_time' => '', //Campaign will be scheduled if a valid date/time is passed. Date/time format eg. June 15, 2021 6:05pm. The minutes part of the time has to be in increments of 5, eg. 6pm, 6:05pm, 6:10pm, 6:15pm.
        'schedule_timezone' => '', //Eg. 'America/New_York'. See the list of PHP's supported timezones. This parameter only applies if you're scheduling your campaign with schedule_date_time parameter. TribeArc will use your default timezone if this parameter is empty.
    ]

);

//subscribe to list
$response = $tribearc->tribearcSubscribeToList(
    [
        "name" => "Kent",
        "email" => "hello@adebayo.com",
        "list" => "your list id",
        "country" => "NG",
    ]
);