Skip to content

ljfreelancer88/phptogo-mailer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 

Repository files navigation

PHP to Go Mailer

Latest Version on Packagist Total Downloads GitHub Actions

Send bulk email in background from PHP to Go. No additional setup like Queuing service.

Installation

You can install phptogo-mailer using go get:

go get -u github.com/ljfreelancer88/phptogo-mailer@latest

Testing

go test -v

Usage

This is just a simple usage. Basically, (1)PHP will just prepare all data needed and (2)pass it to Go binary.

#1 Prepare all data needed

$from = 'Collideborate Team';
$subject = 'John 3:16 song has been added!';

// Fetch rocords from the database.
$recipients = json_encode([
    ["Name" => "Jake", "Email" => "[email protected]"], 
    ["Name" => "Admin", "Email" => "[email protected]"]
]);

$mailerDir = '/cli/phptogo-mailer'; // Where phptogo-mailer compiled binary lives
$mail = "{$mailerDir}/main"; // Compiled binary
$log = " >> {$mailerDir} mailer.log 2>&1 &"; // Log it and do the task in background

#2 Pass it to Go binary
passthru(
    sprintf(
        $mail . " --from %s --subject %s --recipients %s" . $log,
        escapeshellarg($from), 
        escapeshellarg($subject),
        escapeshellarg($recipients)
    )
);

If you want to do it directly on your terminal and skip PHP.

/cli/phptogo-mailer/main --from "Collideborate Team" --subject "John 3:16 song has been added!" --recipients '[{"Name": "Jake", "Email": "[email protected]"}, {"Name": "Admin", "Email": "[email protected]"}]'

Changelog

Please see CHANGELOG for more information what has changed recently.

Contributing

Please see CONTRIBUTING for details.

Security

If you discover any security related issues, please email [email protected] instead of using the issue tracker.

Credits

License

The MIT License (MIT). Please see License File for more information.

About

Send bulk email in background from PHP to Golang

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published