From 1727b2e84d9c6202f4777dff3c6b7433ec8783c7 Mon Sep 17 00:00:00 2001 From: Thomas Mueller Date: Wed, 2 Jan 2013 19:04:08 +0100 Subject: add smtp port configuration option --- lib/mail.php | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) (limited to 'lib/mail.php') diff --git a/lib/mail.php b/lib/mail.php index c78fcce88d4..4683a1b4eee 100644 --- a/lib/mail.php +++ b/lib/mail.php @@ -25,12 +25,18 @@ class OC_Mail { * @param string $mailtext * @param string $fromaddress * @param string $fromname - * @param bool $html + * @param bool|int $html + * @param string $altbody + * @param string $ccaddress + * @param string $ccname + * @param string $bcc + * @throws Exception */ public static function send($toaddress,$toname,$subject,$mailtext,$fromaddress,$fromname,$html=0,$altbody='',$ccaddress='',$ccname='', $bcc='') { $SMTPMODE = OC_Config::getValue( 'mail_smtpmode', 'sendmail' ); $SMTPHOST = OC_Config::getValue( 'mail_smtphost', '127.0.0.1' ); + $SMTPPORT = OC_Config::getValue( 'mail_smtpport', 25 ); $SMTPAUTH = OC_Config::getValue( 'mail_smtpauth', false ); $SMTPUSERNAME = OC_Config::getValue( 'mail_smtpname', '' ); $SMTPPASSWORD = OC_Config::getValue( 'mail_smtppassword', '' ); @@ -49,6 +55,7 @@ class OC_Mail { $mailo->Host = $SMTPHOST; + $mailo->Port = $SMTPPORT; $mailo->SMTPAuth = $SMTPAUTH; $mailo->Username = $SMTPUSERNAME; $mailo->Password = $SMTPPASSWORD; @@ -89,8 +96,6 @@ class OC_Mail { } } - - /** * return the footer for a mail * @@ -103,7 +108,4 @@ class OC_Mail { return($txt); } - - - } -- cgit v1.2.3 From df6ba6955d8fe9692ce9028f71cde962dcc89030 Mon Sep 17 00:00:00 2001 From: j-ed Date: Tue, 22 Jan 2013 14:13:24 +0100 Subject: Update lib/mail.php Added three additional mail_smtp.. parameters. - mail_smtpdebug - enable debug messages to analyse SMTP problems. - mail_smtptimeout - set SMTP timeout which is set to 10s by default and this is sometimes to short especially if a malware/ spam scanner is used. - mail_smtpsecure - force secure SMTP connections. --- lib/mail.php | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'lib/mail.php') 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) { -- cgit v1.2.3