The following warnings occurred:
Warning [2] Undefined variable $unreadreports - Line: 26 - File: global.php(961) : eval()'d code PHP 8.1.2-1ubuntu2.14 (Linux)
File Line Function
/global.php(961) : eval()'d code 26 errorHandler->error
/global.php 961 eval
/printthread.php 16 require_once



UserSpice
smtp Mail - Printable Version

+- UserSpice (https://userspice.com/forums)
+-- Forum: Support Center (https://userspice.com/forums/forumdisplay.php?fid=23)
+--- Forum: UserSpice 4.3 and Below (https://userspice.com/forums/forumdisplay.php?fid=26)
+--- Thread: smtp Mail (/showthread.php?tid=179)



smtp Mail - wolfeman - 07-08-2016

I just did a fresh/new install 4.1.2 and am trying to get the email settings to work. I have setup and verified a mailgun account so send SMTP mail through. How would I go about trouble shooting this?


smtp Mail - mudmin - 07-08-2016

@Brian I know you've done some troubleshooting work.


smtp Mail - brian - 07-08-2016

What settings are you using? At the moment? Obviously mask anything you wouldn't want anyone else to see. Maybe I can try setting up an account and see if it works.


smtp Mail - brian - 07-08-2016

So I just setup a mailgun account, and was able to make it work with userspice just fine. That being said, what email are you using to test sending to? If you are sending to a Gmail account (as I tried to do at first) it may be delayed in delivery due to it being a new setup (mine eventually came through, but took about 10 minutes). If you have an alternate email address to test with, besides gmail, that might help. These are what I used:

SMTP Sever: smtp.mailgun.org
SMTP Port: 587
Email Login/Username: *from mailgun domain dashboard*
Password: *from mailgun domain dashboard*
Transport: TLS (encrypted)

Port 465, and port 25 did NOT work. Port 2525 (as per here: http://blog.mailgun.com/25-465-587-what-port-should-i-use/) DID work as well.

As long as your domain is verified and DNS setup correctly, then it should work fine. I haven't made any changes to my code for this to work.


smtp Mail - wolfeman - 07-11-2016

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;
}


smtp Mail - brian - 07-11-2016

Can you give me the settings that you used for Bluehost or MailGun? I'm sure we can get it working, and TLS should generally work out of the box...