summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLukas Reschke <lukas@statuscode.ch>2013-01-24 00:11:03 -0800
committerLukas Reschke <lukas@statuscode.ch>2013-01-24 00:11:03 -0800
commitf9a9fc5670505c4b3af9ca7b1294730e00330a3b (patch)
tree32edbf100373e4e3584f9a3d961998626dfcf244
parent3ff32eba2563aa0cce99e6c409cab34a04420dc1 (diff)
parentdcda792fbcb3e5743e345553e2fc53fd19a742b9 (diff)
downloadnextcloud-server-f9a9fc5670505c4b3af9ca7b1294730e00330a3b.tar.gz
nextcloud-server-f9a9fc5670505c4b3af9ca7b1294730e00330a3b.zip
Merge pull request #1265 from j-ed/master
add additional mail_smtp.. parameters to fix possible SMTP connection problems.
-rw-r--r--config/config.sample.php10
-rw-r--r--lib/mail.php10
2 files changed, 18 insertions, 2 deletions
diff --git a/config/config.sample.php b/config/config.sample.php
index dafb536fa6f..f26a53c1553 100644
--- a/config/config.sample.php
+++ b/config/config.sample.php
@@ -66,6 +66,9 @@ $CONFIG = array(
/* URL of the appstore to use, server should understand OCS */
"appstoreurl" => "http://api.apps.owncloud.com/v1",
+/* Enable SMTP class debugging */
+"mail_smtpdebug" => false,
+
/* Mode to use for sending mail, can be sendmail, smtp, qmail or php, see PHPMailer docs */
"mail_smtpmode" => "sendmail",
@@ -75,6 +78,13 @@ $CONFIG = array(
/* Port to use for sending mail, depends on mail_smtpmode if this is used */
"mail_smtpport" => 25,
+/* SMTP server timeout in seconds for sending mail, depends on mail_smtpmode if this is used */
+"mail_smtptimeout" => 10,
+
+/* SMTP connection prefix or sending mail, depends on mail_smtpmode if this is used.
+ Can be '', ssl or tls */
+"mail_smtpsecure" => "",
+
/* authentication needed to send mail, depends on mail_smtpmode if this is used
* (false = disable authentication)
*/
diff --git a/lib/mail.php b/lib/mail.php
index 4683a1b4eee..ffc4d01b79f 100644
--- a/lib/mail.php
+++ b/lib/mail.php
@@ -40,6 +40,9 @@ class OC_Mail {
$SMTPAUTH = OC_Config::getValue( 'mail_smtpauth', false );
$SMTPUSERNAME = OC_Config::getValue( 'mail_smtpname', '' );
$SMTPPASSWORD = OC_Config::getValue( 'mail_smtppassword', '' );
+ $SMTPDEBUG = OC_Config::getValue( 'mail_smtpdebug', false );
+ $SMTPTIMEOUT = OC_Config::getValue( 'mail_smtptimeout', 10 );
+ $SMTPSECURE = OC_Config::getValue( 'mail_smtpsecure', '' );
$mailo = new PHPMailer(true);
@@ -57,12 +60,15 @@ class OC_Mail {
$mailo->Host = $SMTPHOST;
$mailo->Port = $SMTPPORT;
$mailo->SMTPAuth = $SMTPAUTH;
+ $mailo->SMTPDebug = $SMTPDEBUG;
+ $mailo->SMTPSecure = $SMTPSECURE;
$mailo->Username = $SMTPUSERNAME;
$mailo->Password = $SMTPPASSWORD;
+ $mailo->Timeout = $SMTPTIMEOUT;
- $mailo->From =$fromaddress;
+ $mailo->From = $fromaddress;
$mailo->FromName = $fromname;;
- $mailo->Sender =$fromaddress;
+ $mailo->Sender = $fromaddress;
$a=explode(' ', $toaddress);
try {
foreach($a as $ad) {