承接 proxiedmail/laravel-receive-email 相关项目开发

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

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

proxiedmail/laravel-receive-email

最新稳定版本:0.0.4

Composer 安装命令:

composer require proxiedmail/laravel-receive-email

包简介

Laravel Receive Email via ProxiedMail library allows creating proxy-emails and receiving emails via webhooks, Rest API.

README 文档

README

ProxiedMail 👷‍♀️ is a simple package for the base library to create proxy emails and receive webhooks or simply browse email list. You can find the base PHP library at https://github.com/proxied-mail/proxiedmail-php-client

You're welcome to visit the docs.

What is the ProxiedMail?

ProxiedMail is a tool that brings the email experience to a new level because it was built around the privacy first concept that enhances using a unique email each time which makes it a second password, but also allows you more control over your correspondence. Additionally, it gives you the advantage of moving to another email provider just in a few seconds. Because we have this kind of system we also aim to bring more into the experience of development using emails.

Features

🛠 Creating endless proxy emails with one of ProxiedMail domains (i.e abc@proxiedmail.com, abcd@pxdmail.com, abcde@pxdmail.net)

🛠 Setting up forwarding email or disabling forwarding

🛠 Setting up a callback to your URL

🛠 Browsing received emails on the received emails endpoint

🛠 Setting up custom domains. You can do everything using your domain as well.

🛠 Domain-to-domain forwarding. Just in case you need it we can forward emails by mask, like *@domainhostedatproxiedmail.com -> *someotherdomain.com. In this case, the MX of the first domain should be pointed to ProxiedMail and the second domain should be verified by TXT record.

📦 Install

Via composer

$ composer require proxiedmail/laravel-receive-email

Setting service provider

This package provide auto-discovery for service provider

If Laravel package auto-discovery is disabled, add service providers manually to /config/app.php. There are service provider you must add:

\ProxiedMail\Client\Providers\ProxiedMailServiceProvider::class

Publish client configuration:

php artisan vendor:publish --tag=proxiedmail

Configure ProxiedMail client:

Put your ProxiedMail API token in /config/proxiedmail.php. You can find this token in ProxiedMail API Settings.

return [
    'apiToken' => 'YOUR API TOKEN',
    'host' => 'https://proxiedmail.com',
];

🚀 Live example

This example demonstrates create proxy emails, browse received emails and receive emails via webhook.

use ProxiedMail\Client\Bridge\ProxiedMailClient;
use ProxiedMail\Client\Facades\ApiFacade;

class ExampleController
{
    public function browseReceivedEmails(ProxiedMailClient $proxiedMailClient)
    {
        /**
         * @var ApiFacade $api
         */
        $api = $proxiedMailClient->getClient();

        $proxyEmail = $api->createProxyEmail(
            [],
            null,
            null,
            null,
            true
        );


        // while (true) with 100 seconds limit
        foreach (range(0, 180) as $non) {
            echo "PROXY-EMAIL: " . $proxyEmail->getProxyAddress() . "\n";
            echo "Time limit is 3 mins \n";
            echo "Send the email to this proxy-email to get email payload printed here \n";

            //checking webhook receiver

            $receivedEmails = $api->getReceivedEmailsLinksByProxyEmailId($proxyEmail->getId())->getReceivedEmailLinks();
            echo "Amount of received emails: " . count($receivedEmails) . "\n";
            foreach ($receivedEmails as $receivedEmail) {
                echo "Have received email: \n";
                var_dump($receivedEmail);

                echo "\n";
            }

            echo "\n";

            sleep(1);
        }
    }


    public function receiveEmailViaWebhook(ProxiedMailClient $proxiedMailClient)
    {
        /**
         * @var ApiFacade $api
         */
        $api = $proxiedMailClient->getClient();

        $wh = $api->createWebhook(); //creating webhook-receiver
        $proxyEmail = $api->createProxyEmail(
            [],
            null,
            $wh->getCallUrl() //specifying webhook url
        );


        // while (true) with 100 seconds limit
        foreach (range(0, 100) as $non) {
            echo "PROXY-EMAIL: " . $proxyEmail->getProxyAddress() . "\n";
            echo "Send the email to this proxy-email to get email payload printed here";

            //checking webhook receiver
            $whStatus = $api->statusWebhook($wh->getId());

            echo "Webhook STATUS: \n";
            echo "Received: " . ($whStatus->isReceived() ? 'yes' : 'no') . "\n"; //printing webhook status

            //printing payload if received
            if ($whStatus->isReceived()) {
                echo "WEBHOOK PAYLOAD: \n";
                echo json_encode($whStatus->getPayload());
                break;
            }


            echo "\n";

            sleep(1);
        }
    }
}

Managing UI

You can create find the UI on ProxiedMail to manage your domains, emails, and webhooks.

🔧 Contributing

Please feel free to fork and sending Pull Requests. This project follows Semantic Versioning 2 and PSR-2.

📄 License

GPL3. Please see License File for more information.

Questions

For any questions please contact laraclient@pxdmail.com

Bonus

Also please check out the article how to receive emails in Laravel in our blog. If you're interested in receiving emails in PHP use the library for pure PHP.

Article: how to receive emails in PHP

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: LGPL-3.0-or-later
  • 更新时间: 2024-02-25