Update mailgun.api.php
This commit is contained in:
parent
456e304ebc
commit
e7e773ec54
|
@ -14,26 +14,28 @@ if(!check_function_exists("mailgun_get_config")) {
|
|||
return array(
|
||||
"domain" => get_value_in_array("mailgun_domain", $config, ""),
|
||||
"name" => get_value_in_array("mailgun_name", $config, "John Doe"),
|
||||
"address" => get_value_in_array("mailgun_address", $config, ""),
|
||||
"from" => get_value_in_array("mailgun_from", $config, ""),
|
||||
"apikey" => get_value_in_array("mailgun_apikey", $config, ""),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
if(!check_function_exists("mailgun_send_message")) {
|
||||
function mailgun_send_message($to, $subject, $content) {
|
||||
function mailgun_send_message($content, $to, $subject="Untitled") {
|
||||
$response = false;
|
||||
|
||||
$app_config = mailgun_get_config();
|
||||
// get mailgun configuration
|
||||
$cnf = mailgun_get_config();
|
||||
|
||||
// make request
|
||||
if(loadHelper("webpagetool")) {
|
||||
$response = get_web_json(sprintf("https://api.mailgun.net/v3/%s/messages", $domain), array(
|
||||
"headers" => array(
|
||||
"Content-Type" => "multipart/form-data",
|
||||
"Authentication" => array("Basic", "api", $app_config['apikey']),
|
||||
"Authentication" => array("Basic", "api", $cnf['apikey']),
|
||||
),
|
||||
"data" => array(
|
||||
"from" => sprintf("%s <%s>", $app_config['name'], $app_config['address']),
|
||||
"from" => sprintf("%s <%s>", $cnf['name'], $cnf['from']),
|
||||
"to" => $to,
|
||||
"subject" => $subject,
|
||||
"text" => $content,
|
||||
|
|
Loading…
Reference in New Issue
Block a user