mirror of
https://github.com/nextcloud/server.git
synced 2026-06-14 19:20:35 -04:00
Merge pull request #7672 from owncloud/backport-7659-stable6-2
Backport 7659 stable6 2
This commit is contained in:
commit
2e42b0555a
2 changed files with 21 additions and 9 deletions
|
|
@ -231,12 +231,27 @@ if (isset($_POST['action']) && isset($_POST['itemType']) && isset($_POST['itemSo
|
|||
$from_address = OCP\Config::getUserValue($user, 'settings', 'email', $default_from );
|
||||
|
||||
// send it out now
|
||||
try {
|
||||
OCP\Util::sendMail($to_address, $to_address, $subject, $text, $from_address, $displayName, 1, $alttext);
|
||||
OCP\JSON::success();
|
||||
} catch (Exception $exception) {
|
||||
OCP\JSON::error(array('data' => array('message' => OC_Util::sanitizeHTML($exception->getMessage()))));
|
||||
$rs = explode(' ', $to_address);
|
||||
$failed = array();
|
||||
foreach ($rs as $r) {
|
||||
try {
|
||||
\OCP\Util::sendMail($r, $r, $subject, $text, $from_address, $displayName, 1, $alttext);
|
||||
} catch (\Exception $e) {
|
||||
\OCP\Util::writeLog('sharing', "Can't send mail with public link to $r: " . $e->getMessage(), \OCP\Util::ERROR);
|
||||
$failed[] = $r;
|
||||
}
|
||||
}
|
||||
|
||||
if (empty($failed)) {
|
||||
OCP\JSON::success();
|
||||
} else {
|
||||
OCP\JSON::error(array(
|
||||
'data' => array(
|
||||
'message' => $l->t("Couldn't send mail to following users: %s ",
|
||||
implode(', ', $failed)
|
||||
)
|
||||
)
|
||||
)); }
|
||||
break;
|
||||
}
|
||||
} else if (isset($_GET['fetch'])) {
|
||||
|
|
|
|||
|
|
@ -72,11 +72,8 @@ class OC_Mail {
|
|||
$mailo->From = $fromaddress;
|
||||
$mailo->FromName = $fromname;;
|
||||
$mailo->Sender = $fromaddress;
|
||||
$a=explode(' ', $toaddress);
|
||||
try {
|
||||
foreach($a as $ad) {
|
||||
$mailo->AddAddress($ad, $toname);
|
||||
}
|
||||
$mailo->AddAddress($toaddress, $toname);
|
||||
|
||||
if($ccaddress<>'') $mailo->AddCC($ccaddress, $ccname);
|
||||
if($bcc<>'') $mailo->AddBCC($bcc);
|
||||
|
|
|
|||
Loading…
Reference in a new issue