-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Lewis Goddard
committed
Dec 3, 2014
1 parent
dba39b5
commit b125447
Showing
13 changed files
with
194 additions
and
169 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1 @@ | ||
Browning_Config.php | ||
Recaptcha_Config.php | ||
config.browning.php |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
<?php | ||
|
||
//// Browning: A Mailgun Script (v0.24) | ||
// https://github.com/eustasy/browning-a-mailgun-script | ||
|
||
//// Mailgun | ||
// Sign up at https://mailgun.com/signup | ||
// First 10,00 mails a month free. | ||
|
||
// Mailgun API URL | ||
// Replace example.com with your domain after signing up at | ||
// $Browning['URL'] = 'https://api.mailgun.net/v2/example.com'; | ||
$Browning['URL'] = 'https://api.mailgun.net/v2/example.com'; | ||
|
||
// Mailgun API Key | ||
// Use API Key found at https://mailgun.com/cp | ||
// $Browning['Key'] = 'key-123456-abcdefg-789012-abc-34567'; | ||
$Browning['Key'] = 'key-123456-abcdefg-789012-abc-34567'; | ||
// Not the Public Key. We don't need that. | ||
|
||
// From for Mail | ||
// $Browning['Default']['Regards'] = 'Example Support'; | ||
$Browning['Default']['Regards'] = 'Example Support'; | ||
|
||
// Reply-to address | ||
// Please don't use noreply. | ||
// Should match the domain in your API URL. | ||
// $Browning['Default']['ReplyTo'] = '[email protected]'; | ||
$Browning['Default']['ReplyTo'] = '[email protected]'; | ||
|
||
//// Recaptcha | ||
// Sign up at https://www.google.com/recaptcha/admin | ||
|
||
// Enable | ||
|
||
// You shouldn't need to change this unless you move the file. | ||
$Recaptcha['Location'] = __DIR__.'/libs/recaptchalib.php'; | ||
|
||
// This is the public key you got from Google. | ||
// They call this a "Site key". | ||
$Recaptcha['Public'] = '0123456789abcdefghijklmnopqrstvwxyzABCDE'; | ||
|
||
// This is the secret one. Don't get them mixed up! | ||
$Recaptcha['Secret'] = 'FGHIJKLMNOPQRSTUVWXYZ0123456789abcdefghi'; | ||
|
||
// Disable | ||
|
||
// $Recaptcha = false; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,102 @@ | ||
<?php | ||
|
||
/* | ||
Browning: A Mailgun Script (v0.24) | ||
https://github.com/eustasy/browning-a-mailgun-script | ||
==================================================== | ||
Browning is a tiny PHP function to send emails with Mailgun, | ||
that uses CURL instead of Mailgun's (slightly porky) library. | ||
Copyright (c) 2014 eustasy under the MIT License | ||
Permission is hereby granted, free of charge, to any person obtaining a copy of | ||
this software and associated documentation files (the "Software"), to deal in | ||
the Software without restriction, including without limitation the rights to | ||
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of | ||
the Software, and to permit persons to whom the Software is furnished to do so, | ||
subject to the following conditions: | ||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS | ||
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR | ||
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER | ||
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN | ||
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | ||
*/ | ||
|
||
function Browning($Dear, $Subject, $Message, $Regards = false, $ReplyTo = false, $Debug = false) { | ||
|
||
global $Browning, $Recaptcha; | ||
|
||
if ( empty($Dear) ) { | ||
return array('Error' => 'No email address defined for recipient.', 'Success' => false); | ||
|
||
} else if ( empty($Subject) ) { | ||
return array('Error' => 'No subject for message.', 'Success' => false); | ||
|
||
} else if ( empty($Message) ) { | ||
return array('Error' => 'You must enter a message, to send a message.', 'Success' => false); | ||
|
||
} else { | ||
|
||
$Browning['Dear'] = $Dear; | ||
$Browning['Subject'] = $Subject; | ||
$Browning['Message'] = $Message; | ||
|
||
if ( $Regards ) { | ||
$Browning['Regards'] = $Regards; | ||
} else { | ||
$Browning['Regards'] = $Browning['Default']['Regards']; | ||
} | ||
|
||
if ( $ReplyTo ) { | ||
$Browning['ReplyTo'] = $ReplyTo; | ||
} else { | ||
$Browning['ReplyTo'] = $Browning['Default']['ReplyTo']; | ||
} | ||
|
||
$Browning['Curl'] = curl_init(); | ||
|
||
curl_setopt($Browning['Curl'], CURLOPT_URL, $Browning['URL'].'/messages'); | ||
curl_setopt($Browning['Curl'], CURLOPT_RETURNTRANSFER, true); | ||
curl_setopt($Browning['Curl'], CURLOPT_USERPWD, 'api:'.$Browning['Key']); | ||
curl_setopt($Browning['Curl'], CURLOPT_HTTPAUTH, CURLAUTH_BASIC); | ||
curl_setopt_array($Browning['Curl'], array( | ||
CURLOPT_POST => 1, | ||
CURLOPT_POSTFIELDS => array( | ||
'from' => $Browning['Regards'].' <'.$Browning['ReplyTo'].'>', | ||
'to' => $Browning['Dear'], | ||
'subject' => $Browning['Subject'], | ||
'text' => $Browning['Message'] | ||
) | ||
)); | ||
|
||
$Browning['Response'] = curl_exec($Browning['Curl']); | ||
$Browning['Info'] = curl_getinfo($Browning['Curl']); | ||
|
||
if ( $Debug ) { | ||
var_dump($Browning['Response']); | ||
var_dump($Browning['Info']); | ||
} | ||
|
||
if ( curl_errno($Browning['Curl']) ) { | ||
return curl_errno($Browning['Curl']).' Error: '.curl_error($Browning['Curl']); | ||
|
||
} else if ( !$Browning['Response'] ) { | ||
return array('Error' => 'Unable to send email. Check your configuration and keys.', 'Success' => false); | ||
|
||
} else { | ||
curl_close($Browning['Curl']); | ||
return array('Error' => false, 'Success' => true); | ||
} | ||
|
||
} | ||
|
||
} |
Oops, something went wrong.