heddiyoussouf/mailtracker

此软件包最新版本(1.0.0)没有提供许可信息。

此软件包提供了一种简单而有效的解决方案,用于使用Laravel应用程序中嵌入的图像来跟踪电子邮件打开情况。通过在电子邮件中嵌入唯一的图像uri,该软件包允许开发人员确定电子邮件何时被收件人打开和查看。

1.0.0 2023-09-06 23:09 UTC

This package is not auto-updated.

Last update: 2024-09-20 04:10:24 UTC


README

heddiyoussouf/mailtracker为Laravel应用程序中跟踪电子邮件打开情况提供了一种高效的方法。它无缝集成,利用嵌入的图像来监控收件人何时查看他们的电子邮件。目录

Features
Installation
Usage
Customizations
Conclusion

功能

Mail Model: Logs individual emails with details.
Mailtracker Model: Records email open actions with attributes such as ip and user_agent.
HasTracker Trait: Equips the Mail model with the ability to generate unique tracking URLs.

安装

通过Composer安装

bash

composer require heddiyoussouf/mailtracker

如果不使用Laravel的包自动发现,请在config/app.php中注册服务提供者

php

'providers' => [
    // ...
    Heddiyoussouf\Mailtracker\MailTrackerProvider::class,
]

用法

根据需要集成Mail和Mailtracker模型。将HasTracker特性附加到您的Mail模型上。生成跟踪URL:对于单个电子邮件:$mail->singleView() 对于广播电子邮件:$mail->multipleView() 在电子邮件的Blade视图中嵌入跟踪图像

blade.php

@mailtracker($trackingURL)

自定义

发布资源和配置

bash

php artisan vendor:publish --provider="Heddiyoussouf\Mailtracker\MailTrackerProvider"

调整图像样式:可以使用其类 mailtracker-image 或其ID mailtracker-image 来调整嵌入的图像样式。

css

.mailtracker-image {
    /* Your styles here */
}
/*or*/
#mailtracker-image {
    /* Your styles here */
}

配置自定义:调整< strong>mailtracker.php 配置以指定自定义图像或进行其他配置。

return [
    'image' => 'assets/footer.png',
];

结论

Mailtracker简化了Laravel中的电子邮件打开跟踪。通过简单集成、详细跟踪和灵活的自定义,它成为所有基于Laravel的电子邮件活动的一个强大解决方案。