this package to facilitate the process of sending email

1.0.9 2024-01-03 12:31 UTC

This package is auto-updated.

Last update: 2024-04-03 13:06:55 UTC


README

this package to facilitate the creation of the email and send it

composer require crazy-email-package/send-email

php artisan vendor:publish --provider="CrazyEmailPackage\SendEmail\CrazySendMailServiceProvider"

// for web
Route::post('/crazy_email', SendMailWebController::class)->name('crazy_email.send_mail');

//  for api
Route::post('/crazy_email', SendMailApiController::class);

this is the route for sending the email

<!-- Include jQuery -->
<script src="https://code.jquery.com/jquery-3.6.4.min.js"></script>

<script>
    $(document).ready(function () {
        $('#sendEmailButton').click(function () {
            // Get form data or create an object with the required parameters
            var mailData = {
                sender_email: "sender@example.com",
                receiver_email: "receiver@example.com",
                subject: "Test Email",
                body: "This is a test email.",
                logo: "path/to/logo.png"
            };

            var viewPath = "emails_templates.mail_notify";

            // Make Ajax request
            $.ajax({
                type: 'POST',
                url: '/crazy_email',
                contentType: 'application/json',
                data: JSON.stringify({
                    mailData: mailData,
                    view_path: viewPath
                }),
                success: function (response) {
                    console.log(response);
                    // Handle success response
                },
                error: function (error) {
                    console.error(error);
                    // Handle error response
                }
            });
        });
    });
</script>
    "sender_email": "mostafa.m.hashem.1@gmail.com",
    "receiver_email": "crazyideacompany@gmail.com",
    "subject": "test email",
    "body": "<h1>Test Email Body </h1>",
    "logo": {the file link}