loremipsum-systems/emailit 问题修复 & 功能扩展

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

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

loremipsum-systems/emailit

Composer 安装命令:

composer require loremipsum-systems/emailit

包简介

SDK for Emailit API

README 文档

README

The EmailItMailer library is a PHP wrapper for interacting with the EmailIt API, allowing you to send emails and manage sending domains effortlessly. Built on top of GuzzleHttp, this library aims to streamline the process of integrating email features into your project.

Features

  • Send emails with HTML, text, custom headers, and file attachments.
  • Retrieve a list of sending domains with pagination and filtering.
  • Fetch detailed information about a specific sending domain.

Requirements

  • PHP 8.1 or higher
  • Composer
  • Required dependencies (managed via Composer):
    • guzzlehttp/guzzle (HTTP client)
    • psr/http-client, psr/http-message, psr/http-factory
    • ralouphie/getallheaders
    • symfony/deprecation-contracts

Installation

Use Composer to install the library:

composer loremipsum-systems/emailit

Usage

Initialization

First, create a new instance of EmailItMailer by providing your API key.

use LoremIpsum\EmailIt\EmailItMailer;

$apiKey = 'your-api-key';
$emailIt = new EmailItMailer($apiKey);

Sending an Email

To send an email, use the send method. This method supports the following parameters:

  • from: Sender's email address.
  • to: Recipient's email address.
  • subject: Email subject.
  • htmlContent: (Optional) HTML email content.
  • textContent: (Optional) Plain text email content.
  • attachments: (Optional) Array of file attachments.
  • headers: (Optional) Array of custom headers.

Here’s an example:

try {
    $response = $emailIt->send(
        'sender@example.com', // Sender
        'recipient@example.com', // Recipient
        'Hello, World!', // Subject
        '<p>This is a test email</p>', // HTML Content
        'This is a test email', // Text Content
        [], // Attachments (optional)
        ['X-Custom-Header' => 'value'] // Custom Headers (optional)
    );
    print_r($response);
} catch (Exception $e) {
    echo 'Error: ' . $e->getMessage();
}

Managing Sending Domains

Get a List of Sending Domains

Retrieve a paginated list of all sending domains using the getSendingDomains method:

try {
    $domains = $emailIt->getSendingDomains(1, 10, 'example'); // Page 1, 10 results, search term "example"
    print_r($domains);
} catch (Exception $e) {
    echo 'Error: ' . $e->getMessage();
}

Fetch Details of a Sending Domain

To get detailed information about a specific sending domain, use the getSendingDomain method:

try {
    $domainDetails = $emailIt->getSendingDomain('domain-id');
    print_r($domainDetails);
} catch (Exception $e) {
    echo 'Error: ' . $e->getMessage();
}

Error Handling

All methods in the EmailItMailer class throw standard PHP Exceptions. Common reasons for exceptions include:

  • Invalid API credentials.
  • HTTP or network errors during API requests.
  • Invalid input, such as malformed attachments.

Use try...catch blocks to handle exceptions gracefully, as shown in the examples above.

Contributing

We welcome contributions to improve the library. Feel free to:

  1. Fork the repository.
  2. Submit a Pull Request (PR) with your improvements.
  3. Ensure all code changes include tests and documentation updates (if applicable).

License

This library is released under the MIT License. See the LICENSE file for details.

Support

If you encounter any issues or need further assistance, please reach out at support@example.com or open a GitHub issue.

Acknowledgments

This library leverages the following dependencies:

  • GuzzleHttp for making HTTP requests.
  • PSR request and response libraries for standardized HTTP message handling.

Notes for Developers

  • Ensure you have proper API documentation access while working with the API endpoints.
  • Always validate attachments before sending email requests to avoid errors.

loremipsum-systems/emailit 适用场景与选型建议

loremipsum-systems/emailit 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 596 次下载、GitHub Stars 达 0, 最近一次更新时间为 2024 年 12 月 11 日, 在 PHP 生态内属于活跃度较高的组件。

我们在过去多个企业项目中使用过 loremipsum-systems/emailit 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 loremipsum-systems/emailit 我们能提供哪些服务?
定制开发 / 二次开发

基于 loremipsum-systems/emailit 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2024-12-11