fix: typo
refactor
fix: bug in readme
Send email via their http api.
Install:
composer require thirdplace/mailgun:dev-main
Example:
<?php
use function Thirdplace\mailgun_message_send;
$apiDomain = 'example.com';
$apiKey = 'key-XXXXXXXXXXXXXXXXXXXXXX';
$result = mailgun_message_send(
$apiDomain,
$apiKey,
'noreply@example.com',
'recipient@example.com',
'Here is the subject',
'Here is the email body',
);
var_dump($result);
Output:
array(2) {
[0]=>
int(200)
[1]=>
string(88) "{"id":"<20220423070303.1449106df60a3dbb@example.com>","message":"Queued. Thank you."}
"
}
Uses the us endpoint.
function mailgun_message_send(
string $apiDomain,
string $apiKey,
string $from,
string $to,
string $subject,
string $text
): array