2
0
mirror of https://github.com/ACSPRI/queXS synced 2024-04-02 12:12:16 +00:00

Respect the limesurvey email settings

This commit is contained in:
Adam Zammit
2013-04-05 15:53:11 +11:00
parent cf26797cbf
commit 5105f3f3de

View File

@@ -141,6 +141,48 @@ if (isset($_POST['firstname']))
$mail = new PHPMailer;
$sql = "SELECT stg_value
FROM " . LIME_PREFIX . "settings_global
WHERE stg_name = 'emailmethod'";
$emailmethod = $db->GetOne($sql);
switch ($emailmethod) {
case "qmail":
$mail->IsQmail();
break;
case "smtp":
$mail->IsSMTP();
$sql = "SELECT stg_name,stg_value
FROM " . LIME_PREFIX . "settings_global";
$ec =$db->GetAssoc($sql);
if (strpos($ec['emailsmtphost'],':')>0)
{
$mail->Host = substr($ec['emailsmtphost'],0,strpos($ec['emailsmtphost'],':'));
$mail->Port = substr($ec['emailsmtphost'],strpos($ec['emailsmtphost'],':')+1);
}
else {
$mail->Host = $ec['emailsmtphost'];
}
$mail->Username =$ec['emailsmtpuser'];
$mail->Password =$ec['emailsmtppassword'];
if (trim($ec['emailsmtpuser'])!="")
{
$mail->SMTPAuth = true;
}
break;
case "sendmail":
$mail->IsSendmail();
break;
default:
//Set to the default value to rule out incorrect settings.
$emailmethod="mail";
$mail->IsMail();
}
$sql = "SELECT stg_value
FROM " . LIME_PREFIX . "settings_global
WHERE stg_name LIKE 'siteadminemail'";