summaryrefslogtreecommitdiff
path: root/inc/functions.php
diff options
context:
space:
mode:
authorCarson Fleming <cflems@cflems.net>2022-12-12 03:18:01 -0800
committerCarson Fleming <cflems@cflems.net>2022-12-12 03:18:01 -0800
commit65398eb82a19f3e99085c65630e9df2e3874a089 (patch)
treea73977151b738397c09477f81b2c9ae4c5038ee2 /inc/functions.php
parent3469db615ee6f8e4a8846de794e4fc66333a142e (diff)
downloadbulletin-65398eb82a19f3e99085c65630e9df2e3874a089.tar.gz
Add option to send mail with regular mail function instead of mailgun
Diffstat (limited to 'inc/functions.php')
-rw-r--r--inc/functions.php27
1 files changed, 17 insertions, 10 deletions
diff --git a/inc/functions.php b/inc/functions.php
index 34b74aa..4bd37af 100644
--- a/inc/functions.php
+++ b/inc/functions.php
@@ -75,17 +75,24 @@ function bulletin_hash ($str, $salt = '') {
function bulletin_mail ($to, $subject, $body) {
global $b_config;
- try {
- $mg = new Mailgun\Mailgun($b_config['mg_key']);
- return $mg->sendMessage($b_config['mg_dom'], array(
- 'from' => $b_config['mail_from'],
- 'to' => $to,
- 'subject' => $subject,
- 'html' => $body,
- ));
- } catch (Exception $e) {
- return 0;
+ if (isset($b_config['mg_key'])) {
+ try {
+ $mg = new Mailgun\Mailgun($b_config['mg_key']);
+ return $mg->sendMessage($b_config['mg_dom'], array(
+ 'from' => $b_config['mail_from'],
+ 'to' => $to,
+ 'subject' => $subject,
+ 'html' => $body,
+ ));
+ } catch (Exception $e) {
+ return 0;
+ }
}
+ //$headers = 'To: ' . $to . "\r\n";
+ $headers = 'From: ' . $b_config['mail_from'] . "\r\n";
+ $headers .= 'MIME-Version: 1.0' . "\r\n";
+ $headers .= 'Content-type: text/html; charset=utf-8'
+ return mail($to, $subject, $body, $headers);
}
function pwgen ($len) {