magexon/turbosmtp-php 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

magexon/turbosmtp-php

最新稳定版本:1.0.0

Composer 安装命令:

composer require magexon/turbosmtp-php

包简介

TurboSMTP PHP SDK for sending emails, managing relays, suppressions, and email validation

README 文档

README

smtp mail server – professional SMTP service provider

turboSMTP-php SDK

The Official turboSMTP PHP SDK - enables .PHP Developers to work with turboSMTP API efficiently.

Table of contents

Getting Started

Requirements

  • PHP 7.4+.
  • A turboSMTP account, sign up for free to send up to 6.000 FREE emails per month (No Obligation - No Credit card required).

Installation

Install the SDK via Composer:

composer require magexon/turbosmtp-php

API Key

Review. Create your API Key from turboSMTP Dashboard.

Quick start with TurboSMTP Client

In order to facilitate construction and usage of TurboSMTPClientConfiguration, a TurboSMTPClientConfigurationBuilder has been facilitated implementing a Builder design pattern:

TurboSMTP Client Configuration Initialization

As stated above, TurboSMTPClientConfiguration uses a builder design pattern (TurboSMTPClientConfigurationBuilder) that allows to setup your ConsumerKey and Secret, option for EuropeanUser and your Timezone that will be used to consume time sensitive data, like when filtering data by dates.

<?php

namespace SampleNameSpace;

use TurboSMTP\TurboSMTPClientConfigurationBuilder;

class Sample 
{
    public function sample_method()
    {
        $configurationBuilder = new TurboSMTPClientConfigurationBuilder();

        $configuration = $configurationBuilder
                ->setConsumerKey(AppConstants::ConsumerKey)
                ->setConsumerSecret(AppConstants::ConsumerSecret)
                ->setEuropeanUser(AppConstants::EuropeanUser)
                ->build();
    } 
}

TurboSMTP Client Initialization

In order to create a TurboSMTPClient simply pass a TurboSMTPClientConfiguration to it´s constructor as:

<?php

namespace SampleNameSpace;

use TurboSMTP\TurboSMTPClientConfigurationBuilder;
use TurboSMTP\TurboSMTPClient;

class Sample 
{
    public function sample_method()
    {
        $configurationBuilder = new TurboSMTPClientConfigurationBuilder();

        $configuration = $configurationBuilder
                ->setConsumerKey(AppConstants::ConsumerKey)
                ->setConsumerSecret(AppConstants::ConsumerSecret)
                ->setEuropeanUser(AppConstants::EuropeanUser)
                ->build();

        $ts_client = new TurboSMTPClient($configuration);                
    } 
}

TurboSMTP Client Hello World Email example

<?php

namespace SampleNameSpace;

use TurboSMTP\TurboSMTPClientConfigurationBuilder;
use TurboSMTP\TurboSMTPClient;
use TurboSMTP\Domain\EmailMessage\EmailMessageBuilder;

class Sample 
{
    public function sample_method()
    {
        $configurationBuilder = new TurboSMTPClientConfigurationBuilder();

        $configuration = $configurationBuilder
                ->setConsumerKey(AppConstants::ConsumerKey)
                ->setConsumerSecret(AppConstants::ConsumerSecret)
                ->setEuropeanUser(AppConstants::EuropeanUser)
                ->build();

        $ts_client = new TurboSMTPClient($configuration);
        
        $emailBuilder = new EmailMessageBuilder();
        // Build the email message
        $emailMessage = $emailBuilder
            ->setFrom('sender@yourdomain.com')
            ->addTo('recipient@domain.com')
            ->setSubject('Hello World Simple Email')
            ->setHtmlContent('This email has been sent using <b>turboSMTP SDK</b>.')
            ->build(); // Call build to get the EmailMessage instance
        
        //Send the Email Message.
        $result = $ts_client->getEmailMessages()->SendAsync($emailMessage)->wait();

        //Print the returned message ID.
        echo $result->getMessageID();    
    } 
}

After executing the above code, $result->getMessage() should be OK and $result->getMessageID() should contain a reference number to your sending operation, and you should have an email in the inbox of the to recipient. You can check the status of your email in the UI, or using TurboSMTPClient->getRelays()->queryAsync() method. Alternatively, we can post events to a URL of your choice using our Event Webhooks. This gives you information about the events that occur as turboSMTP processes your email.

Usage

Contribute

Thank you for considering contributing to our SDK! We welcome all forms of contributions, including bug reports and feature requests.

Your feedback is invaluable in helping us improve and expand our SDK, please refere to our CONTRIBUTING guide for details.

For any inquiries, you can contact us at the following email address:

Email: sdk@turbo-smtp

Quick links:

Troubleshooting

Please see our troubleshooting guide for common library issues.

About

turboSMTP-php is maintained and funded by Turbo SMTP Company. The names and logos for turboSMTP-php are trademarks of TurboSMTP Company.

Support

If you need help using Turbo SMTP SDK, please check the TurboSMTP Support Help Center.

License

This SDK is licensed under the MIT License - see the LICENSE file for details.

统计信息

  • 总下载量: 7
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 6
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 0
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2026-04-20

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固