Skip to content

Commit a59498f

Browse files
author
mcramer
committed
Implemented FS#2383 - SMTP function for all outgoing ispconfig mailer
1 parent 5e4f60c commit a59498f

File tree

7 files changed

+687
-4
lines changed

7 files changed

+687
-4
lines changed

interface/lib/classes/functions.inc.php

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,28 @@ public function mail($to, $subject, $text, $from, $filepath = '', $filetype = 'a
3939

4040
if($conf['demo_mode'] == true) $app->error("Mail sending disabled in demo mode.");
4141

42+
$app->uses('getconf,ispcmail');
43+
$mail_config = $app->getconf->get_global_config('mail');
44+
if($mail_config['smtp_enabled'] == 'y') {
45+
$mail_config['use_smtp'] = true;
46+
$app->ispcmail->setOptions($mail_config);
47+
}
48+
$app->ispcmail->setSender($from);
49+
$app->ispcmail->setSubject($subject);
50+
$app->ispcmail->setMailText($text);
51+
52+
if($filepath != '') {
53+
if(!file_exists($filepath)) $app->error("Mail attachement does not exist ".$filepath);
54+
$app->ispcmail->readAttachFile($filepath);
55+
}
56+
57+
if($cc != '') $app->ispcmail->setHeader('Cc', $cc);
58+
if($bcc != '') $app->ispcmail->setHeader('Bcc', $bcc);
59+
60+
$app->ispcmail->send($to);
61+
$app->ispcmail->finish();
62+
63+
/* left in here just for the case...
4264
if($filepath != '') {
4365
if(!file_exists($filepath)) $app->error("Mail attachement does not exist ".$filepath);
4466
@@ -83,7 +105,7 @@ public function mail($to, $subject, $text, $from, $filepath = '', $filetype = 'a
83105
$subject = "=?utf-8?B?".base64_encode($subject)."?=";
84106
mail($to, $subject, $text, $header);
85107
}
86-
108+
*/
87109
return true;
88110
}
89111

0 commit comments

Comments
 (0)