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(
|
return array(
|
||||||
"domain" => get_value_in_array("mailgun_domain", $config, ""),
|
"domain" => get_value_in_array("mailgun_domain", $config, ""),
|
||||||
"name" => get_value_in_array("mailgun_name", $config, "John Doe"),
|
"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, ""),
|
"apikey" => get_value_in_array("mailgun_apikey", $config, ""),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!check_function_exists("mailgun_send_message")) {
|
if(!check_function_exists("mailgun_send_message")) {
|
||||||
function mailgun_send_message($to, $subject, $content) {
|
function mailgun_send_message($content, $to, $subject="Untitled") {
|
||||||
$response = false;
|
$response = false;
|
||||||
|
|
||||||
$app_config = mailgun_get_config();
|
// get mailgun configuration
|
||||||
|
$cnf = mailgun_get_config();
|
||||||
|
|
||||||
|
// make request
|
||||||
if(loadHelper("webpagetool")) {
|
if(loadHelper("webpagetool")) {
|
||||||
$response = get_web_json(sprintf("https://api.mailgun.net/v3/%s/messages", $domain), array(
|
$response = get_web_json(sprintf("https://api.mailgun.net/v3/%s/messages", $domain), array(
|
||||||
"headers" => array(
|
"headers" => array(
|
||||||
"Content-Type" => "multipart/form-data",
|
"Content-Type" => "multipart/form-data",
|
||||||
"Authentication" => array("Basic", "api", $app_config['apikey']),
|
"Authentication" => array("Basic", "api", $cnf['apikey']),
|
||||||
),
|
),
|
||||||
"data" => array(
|
"data" => array(
|
||||||
"from" => sprintf("%s <%s>", $app_config['name'], $app_config['address']),
|
"from" => sprintf("%s <%s>", $cnf['name'], $cnf['from']),
|
||||||
"to" => $to,
|
"to" => $to,
|
||||||
"subject" => $subject,
|
"subject" => $subject,
|
||||||
"text" => $content,
|
"text" => $content,
|
||||||
|
|
Loading…
Reference in New Issue
Block a user