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

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

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

lettermint/lettermint-php

最新稳定版本:1.5.1

Composer 安装命令:

composer require lettermint/lettermint-php

包简介

Official Lettermint PHP SDK.

README 文档

README

Latest Version on Packagist GitHub Tests Action Status GitHub Code Style Action Status Total Downloads Join our Discord server

Integrate Lettermint in your PHP project.

Requirements

  • PHP 8.2 or higher
  • Composer

Installation

You can install the package via composer:

composer require lettermint/lettermint-php

Usage

Initialize the Lettermint client with your API token:

$lettermint = new Lettermint\Lettermint('your-api-token');

Sending Emails

The SDK provides a fluent interface for composing and sending emails:

$response = $lettermint->email
                       ->from('sender@example.com')
                       ->to('recipient@example.com')
                       ->subject('Hello from Lettermint!')
                       ->text('Hello! This is a test email.')
                       ->send();

The SDK supports various email features:

$lettermint->email
    ->from('John Doe <john@example.com>')
    ->to('recipient1@example.com', 'recipient2@example.com')
    ->cc('cc@example.com')
    ->bcc('bcc@example.com')
    ->replyTo('reply@example.com')
    ->subject('Hello world!')
    ->html('<h1>Hello!</h1>')
    ->text('Hello!')
    ->headers(['X-Custom-Header' => 'Value'])
    ->attach('document.pdf', base64_encode($fileContent))
    ->attach('logo.png', base64_encode($logoContent), 'logo@example.com')
    ->route('my-route-id')
    ->idempotencyKey('unique-request-id-123')
    ->send();

Inline Attachments

You can embed images and other content in your HTML emails using content IDs:

$lettermint->email
    ->from('sender@example.com')
    ->to('recipient@example.com')
    ->subject('Email with inline image')
    ->html('<p>Here is an image: <img src="cid:logo@example.com"></p>')
    ->attach('logo.png', base64_encode($imageContent), 'logo@example.com')
    ->send();

Idempotency

To ensure that duplicate requests are not processed, you can use an idempotency key:

$response = $lettermint->email
                       ->from('sender@example.com')
                       ->to('recipient@example.com')
                       ->subject('Hello from Lettermint!')
                       ->text('Hello! This is a test email.')
                       ->idempotencyKey('unique-request-id-123')
                       ->send();

The idempotency key should be a unique string that you generate for each unique email you want to send. If you make the same request with the same idempotency key, the API will return the same response without sending a duplicate email.

For more information, refer to the documentation.

Testing

composer test

Changelog

Please see CHANGELOG for more information on what has changed recently.

Contributing

Please see CONTRIBUTING for details.

Security Vulnerabilities

Please review our security policy on how to report security vulnerabilities.

Credits

License

The MIT License (MIT). Please see License File for more information.

统计信息

  • 总下载量: 12.34k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 4
  • 点击次数: 2
  • 依赖项目数: 2
  • 推荐数: 0

GitHub 信息

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

其他信息

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

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固