PHPackages                             omdiaries/laravel-ai-email-assistant - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Mail &amp; Notifications](/categories/mail)
4. /
5. omdiaries/laravel-ai-email-assistant

ActiveLibrary[Mail &amp; Notifications](/categories/mail)

omdiaries/laravel-ai-email-assistant
====================================

AI-powered email generator for Laravel (9, 10, 11 compatible) supporting OpenAI and Gemini

v1.0.23(6mo ago)3291MITPHPPHP &gt;=8.0

Since Oct 31Pushed 6mo ago2 watchersCompare

[ Source](https://github.com/intel1590/laravel-ai-email-assistant)[ Packagist](https://packagist.org/packages/omdiaries/laravel-ai-email-assistant)[ RSS](/packages/omdiaries-laravel-ai-email-assistant/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (2)Dependencies (3)Versions (19)Used By (0)

🚀 Laravel AI Email Assistant — v1.0.23 (Stable)
===============================================

[](#-laravel-ai-email-assistant--v1023-stable)

[![Version](https://camo.githubusercontent.com/34e695c6016bc2a934a96bed696e29b2f2ab562a7134d65a55d00653cd506bea/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f76657273696f6e2d312e302e302d626c75652e737667)](https://camo.githubusercontent.com/34e695c6016bc2a934a96bed696e29b2f2ab562a7134d65a55d00653cd506bea/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f76657273696f6e2d312e302e302d626c75652e737667)
[![License](https://camo.githubusercontent.com/8bb50fd2278f18fc326bf71f6e88ca8f884f72f179d3e555e20ed30157190d0d/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d677265656e2e737667)](https://camo.githubusercontent.com/8bb50fd2278f18fc326bf71f6e88ca8f884f72f179d3e555e20ed30157190d0d/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d677265656e2e737667)
[![Laravel](https://camo.githubusercontent.com/63dbf63d6029d95a2ac536e9a771260a73e2066598641113544e8e2e3755f320/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4c61726176656c2d392532422d7265642e737667)](https://camo.githubusercontent.com/63dbf63d6029d95a2ac536e9a771260a73e2066598641113544e8e2e3755f320/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4c61726176656c2d392532422d7265642e737667)

**AI-powered email generator for Laravel (9, 10, 11 compatible)**
Generate professional, context-aware, and customizable emails using AI — directly from your Laravel app.

---

🧠 Key Features
--------------

[](#-key-features)

✅ **Multi-AI Provider Support** — use **OpenAI**, **Gemini**, or add your own
✅ **Customizable Tones** — *Formal*, *Friendly*, *Persuasive*, *Empathetic*, etc.
✅ **Dynamic Output Types** — generate *plain text*, *HTML*, or *Markdown* emails
✅ **Prebuilt Prompt Templates** — *Welcome*, *Invoice*, *Follow-up*, *Support*
✅ **Extendable Template System** — easily define new templates
✅ **Centralized Logging** — detailed request/response tracking via Laravel logs
✅ **Configurable Error Handling** — automatic fallbacks when an AI provider fails
✅ **Lightweight &amp; Fast** — optimized for production

---

🛠️ Installation
---------------

[](#️-installation)

**Step 1:** Install the package via Composer

```
composer require omdiaries/laravel-ai-email-assistant
```

**Step 2:** Publish the configuration file

```
php artisan vendor:publish --tag=ai-email-assistant-config
```

**Step 3:** Add your environment variables

```
AI_PROVIDER=openai
AI_API_KEY=your_api_key_here
AI_TONE=formal
AI_OUTPUT_TYPE=html
```

**Step 4:** Generate an AI-based email using Artisan

```
php artisan ai-email:generate welcome
```

---

💡 Example Usage (Controller)
----------------------------

[](#-example-usage-controller)

```
use OmDiaries\AiEmailAssistant\Facades\AiEmail;

$email = AiEmail::generate([
    'template' => 'invoice',
    'tone' => 'friendly',
    'outputType' => 'html',
]);

Mail::to('john@example.com')->send(new InvoiceMail($email));
```

---

⚙️ Supported Templates
----------------------

[](#️-supported-templates)

- `welcome`
- `invoice`
- `followup`
- `support`

You can create your own custom templates under:

```
config/ai-email-assistant.php

```

---

🧩 Supported AI Providers
------------------------

[](#-supported-ai-providers)

- **OpenAI (GPT Models)**
- **Google Gemini**
- *(More coming soon)*

You can easily extend it by creating a new Adapter class under:
`app/Adapters/YourAIProviderAdapter.php`

---

⚙️ Advanced Settings (From Code Base)
-------------------------------------

[](#️-advanced-settings-from-code-base)

```
return [

    // Default AI provider
    'default_provider' => env('AI_PROVIDER', 'openai'),

    // Available providers
    'providers' => [
        'openai' => [
            'api_key' => env('AI_API_KEY'),
        ],
        'gemini' => [
            'api_key' => env('AI_API_KEY'),
        ],
    ],

    // Default tone for generated emails
    'default_tone' => env('AI_TONE', 'formal'),

    // Output type: text, html, markdown
    'default_output' => env('AI_OUTPUT_TYPE', 'html'),

    // Enable or disable logging of AI responses
    'logging' => true,

    // Prompt templates
    'templates' => [
        'welcome' => 'Write a warm welcome email for a new user...',
        'invoice' => 'Create a polite invoice reminder email...',
        'followup' => 'Generate a friendly follow-up email...',
        'support' => 'Generate a professional support response...',
    ],
];
```

---

🧠 AIEmailService Overview
-------------------------

[](#-aiemailservice-overview)

The main service handles:

- ✅ Provider selection (`OpenAI`, `Gemini`, etc.)
- ✅ Dynamic prompt generation from templates
- ✅ Error-safe API calls with fallback strategy
- ✅ Logging with `Log::info()` and `Log::error()`
- ✅ Flexible output type formatting

---

🔄 Upgrade Notes (from Beta)
---------------------------

[](#-upgrade-notes-from-beta)

- Added full multi-provider adapter support
- Introduced advanced tone and output customization
- Enhanced logging &amp; debugging system
- Improved exception handling for provider timeouts
- Rewritten config system for flexibility

---

🧑‍💻 Contributing
----------------

[](#‍-contributing)

Pull requests are welcome!
For new providers or features, please open an issue first to discuss the implementation.

---

🪪 License
---------

[](#-license)

This project is licensed under the **MIT License**.
© 2025 OmDiaries — All rights reserved.

###  Health Score

36

—

LowBetter than 82% of packages

Maintenance67

Regular maintenance activity

Popularity11

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity49

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~0 days

Total

17

Last Release

191d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/5f7fd65d5c8199b724ac1d7baba5b66fb2bcdeafc4290065c8f2c4daa3e0a999?d=identicon)[intel1590](/maintainers/intel1590)

---

Top Contributors

[![intel1590](https://avatars.githubusercontent.com/u/241280411?v=4)](https://github.com/intel1590 "intel1590 (31 commits)")

---

Tags

aiai-emailai-email-assistantai-email-generatorai-email-temaplateai-email-template-generatoremailemail-assistantemail-templateemail-templatesemaildetectionlaravellaravel-frameworklaravel-packagelarge-language-modelsopen-aiphp

### Embed Badge

![Health badge](/badges/omdiaries-laravel-ai-email-assistant/health.svg)

```
[![Health](https://phpackages.com/badges/omdiaries-laravel-ai-email-assistant/health.svg)](https://phpackages.com/packages/omdiaries-laravel-ai-email-assistant)
```

###  Alternatives

[laravel-notification-channels/telegram

Telegram Notifications Channel for Laravel

1.1k3.4M35](/packages/laravel-notification-channels-telegram)[laravel-notification-channels/fcm

FCM (Firebase Cloud Messaging) Notifications Driver for Laravel

5917.0M16](/packages/laravel-notification-channels-fcm)[s-ichikawa/laravel-sendgrid-driver

This library adds a 'sendgrid' mail driver to Laravel.

4139.3M1](/packages/s-ichikawa-laravel-sendgrid-driver)[laravel-notification-channels/microsoft-teams

A Laravel Notification Channel for Microsoft Teams

1603.0M7](/packages/laravel-notification-channels-microsoft-teams)[laravel-notification-channels/discord

Laravel notification driver for Discord.

2371.3M11](/packages/laravel-notification-channels-discord)[tzsk/sms

A robust and unified SMS gateway integration package for Laravel, supporting multiple providers.

320244.3k6](/packages/tzsk-sms)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
