The following warnings occurred:
Warning [2] Undefined variable $unreadreports - Line: 26 - File: global.php(961) : eval()'d code PHP 8.2.25 (Linux)
File Line Function
/global.php(961) : eval()'d code 26 errorHandler->error
/global.php 961 eval
/showthread.php 28 require_once





× This forum is read only. As of July 23, 2019, the UserSpice forums have been closed. To receive support, please join our Discord by clicking here. Thank you!

  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
smtp Mail
#5
For the life of me I could not get the SMTP from either my host (bluehost.com) or to MailGun's SMTP working. So I ended up modifying the users/helpers/helper.php email function to use phpCurl into MailGun. It took another DBTable (as I did not want to force changes on the email table) but all seems to be working now. I'm sure more testing is needed.

function email($to,$subject,$body){
$db = DB::getInstance();
$query = $db->query("SELECT * FROM MYmailgun");
$results = $query->first();
$config = array();
$config['api_key'] = $results->apikey;
$config['api_url'] = $results->apiurl;
$message = array();
$message['from'] = $results->from_email;
$message['to'] = $to;
$message['h:Reply-To'] = $results->from_email;
$message['subject'] = $subject;
$message['html'] = $body;
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $config['api_url']);
curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
curl_setopt($ch, CURLOPT_USERPWD, "api:{$config['api_key']}");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 10);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS,$message);
$result = curl_exec($ch);
curl_close($ch);
return $result;
}
  Reply


Messages In This Thread
smtp Mail - by wolfeman - 07-08-2016, 02:15 AM
smtp Mail - by mudmin - 07-08-2016, 12:37 PM
smtp Mail - by brian - 07-08-2016, 02:03 PM
smtp Mail - by brian - 07-08-2016, 02:54 PM
smtp Mail - by wolfeman - 07-11-2016, 04:21 PM
smtp Mail - by brian - 07-11-2016, 05:13 PM

Forum Jump:


Users browsing this thread: 1 Guest(s)