mirror of
https://git.code.sf.net/p/seeddms/code
synced 2024-11-26 23:42:11 +00:00
50 lines
1.5 KiB
PHP
50 lines
1.5 KiB
PHP
<?php
|
|
/**
|
|
* Implementation of email utils
|
|
*
|
|
* @category DMS
|
|
* @package SeedDMS
|
|
* @license GPL 2
|
|
* @version @version@
|
|
* @author Uwe Steinmann <uwe@steinmann.cx>
|
|
* @copyright Copyright (C) 2002-2005 Markus Westphal,
|
|
* 2006-2008 Malcolm Cowe, 2010 Matteo Lucarelli,
|
|
* 2010 Uwe Steinmann
|
|
* @version Release: @package_version@
|
|
*/
|
|
|
|
/**
|
|
* Class to send email
|
|
*
|
|
* @category DMS
|
|
* @package SeedDMS
|
|
* @author Markus Westphal, Malcolm Cowe, Uwe Steinmann <uwe@steinmann.cx>
|
|
* @copyright Copyright (C) 2002-2005 Markus Westphal,
|
|
* 2006-2008 Malcolm Cowe, 2010 Matteo Lucarelli,
|
|
* 2010 Uwe Steinmann
|
|
* @version Release: @package_version@
|
|
*/
|
|
class SeedDMS_EmailUtils {
|
|
|
|
function sendPassword($sender, $recipient, $subject, $message) { /* {{{ */
|
|
$headers = array();
|
|
$headers[] = "MIME-Version: 1.0";
|
|
$headers[] = "Content-type: text/plain; charset=utf-8";
|
|
$headers[] = "From: ". $sender;
|
|
$headers[] = "Reply-To: ". $sender;
|
|
|
|
$subject = "=?UTF-8?B?".base64_encode($this->replaceMarker($subject))."?=";
|
|
return (mail($recipient->getEmail(), $subject, $this->replaceMarker($message), implode("\r\n", $headers)) ? 0 : -1);
|
|
} /* }}} */
|
|
|
|
function replaceMarker($text) { /* {{{ */
|
|
global $settings;
|
|
|
|
return(str_replace(
|
|
array('###SITENAME###', '###HTTP_ROOT###', '###URL_PREFIX###'),
|
|
array($settings->_siteName, $settings->_httpRoot, getBaseUrl().$settings->_httpRoot),
|
|
$text));
|
|
} /* }}} */
|
|
|
|
}
|