承接 bayramoff-com/telegram-mail-driver 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

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

bayramoff-com/telegram-mail-driver

最新稳定版本:0.1.8

Composer 安装命令:

composer require bayramoff-com/telegram-mail-driver

包简介

Telegram Mail Driver for Laravel

README 文档

README

A custom mail driver for Laravel (9, 10, 11, and beyond) that sends messages via the Telegram Bot API instead of traditional email. Perfect for sending real-time notifications or alerts directly to Telegram chats.

Features

  • Plug-and-Play: Integrates seamlessly into Laravel's Mail system.
  • Customizable: Configure your Telegram chat ID and bot token via .env.
  • Lightweight: Uses Guzzle for HTTP requests and Symfony Mailer for compatibility.

Installation

1. Add the Package

Run:

composer require bayramoff-com/telegram-mail-driver:0.1.4

2. Publish the Config

After installation, publish the configuration file:

php artisan vendor:publish --provider="BayramoffCom\TelegramMailDriver\Providers\TelegramMailServiceProvider" --tag=telegram-mail-config

This creates a config/telegram-mail.php file in your Laravel app.

3. Update .env

Set your Telegram bot details in .env:

MAIL_MAILER=telegram
MAIL_USERNAME=123456789         # Telegram chat_id
MAIL_PASSWORD=999999:ABC-XYZ123 # Telegram bot token

4. Update config/mail.php

Add the telegram mailer to your config/mail.php:

return [
    'mailers' => [
        // Existing mailers...
        'telegram' => [
            'transport' => 'telegram',
        ],
    ],
];

Clear your config cache if needed:

php artisan config:clear
php artisan cache:clear

Usage

Use Laravel's Mail facade as usual:

use Illuminate\Support\Facades\Mail;

Route::get('/test-telegram', function () {
    Mail::raw('Hello from Telegram Mail Driver!', function ($message) {
        $message->subject('Test Telegram Mail Driver');
        $message->to('ignored@example.com'); // Ignored by TelegramTransport
    });

    return 'Message sent to Telegram!';
});

Messages will be sent to the Telegram chat_id defined in .env.

License

This package is open-sourced software licensed under the MIT License.

Enjoy sending Laravel emails via Telegram!

统计信息

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

GitHub 信息

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

其他信息

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