' . "\r\n";
}
foreach ($to as $address)
{
// $logger = EnvironmentManager::getLogger();
if (mail($address, $subject, $body,$headers)) {
$status = "OK";
} else {
$status = "FAILED";
}
// $logger->append("Sending email","Status: ".$status." To: ".$address." Subject: ".$subject);
}
}
public static function sendMailTextAttachement($to, $subject, $message, $attachement,$filename)
{
$content = chunk_split(base64_encode($attachement));
$uid = md5(uniqid(time()));
$header = "From: " . MAILFROM_ADDRESS . "\r\n"
. "MIME-Version: 1.0\r\n"
. "Content-Type: multipart/mixed; charset=utf-8; boundary=\"" . $uid . "\"\r\n\r\n"
. "This is a multi-part message in MIME format.\r\n\r\n"
. "--" . $uid . "\r\n"
. "Content-Type: text/html; charset=utf-8"."\r\n"
. "Content-Transfer-Encoding: 8bit"."\r\n\r\n"
. $message . "\r\n\r\n"
. "--" . $uid . "\r\n"
. "Content-Type: text/plain; charset=utf-8; name=\"".$filename."\"\r\n"
. "Content-Transfer-Encoding: base64\r\n"
. "Content-Disposition: attachment; filename=\"".$filename."\"\r\n\r\n"
. $content . "\r\n\r\n"
. "--" . $uid . "--";
self::sendMail($to, $subject, "", $header);
}
public static function sendMailAttachment($to, $subject, $message, $attachement,$filename, $type = "text/html")
{
$content = chunk_split(base64_encode($attachement));
$uid = md5(uniqid(time()));
$header = "From: " . MAILFROM_ADDRESS . "\r\n"
. "MIME-Version: 1.0\r\n"
. "Content-Type: multipart/mixed; charset=utf-8; boundary=\"" . $uid . "\"\r\n\r\n"
. "This is a multi-part message in MIME format.\r\n\r\n"
. "--" . $uid . "\r\n"
. "Content-Type: text/html; charset=utf-8"."\r\n"
. "Content-Transfer-Encoding: 8bit"."\r\n\r\n"
. $message . "\r\n\r\n"
. "--" . $uid . "\r\n"
. "Content-Type: ".$type."; name=\"".$filename."\"\r\n"
. "Content-Transfer-Encoding: base64\r\n"
. "Content-Disposition: attachment; filename=\"".$filename."\"\r\n\r\n"
. $content . "\r\n\r\n"
. "--" . $uid . "--";
self::sendMail($to, $subject, "", $header);
}
public static function sendMailTextAttachments($to, $subject, $message, $files)
{
$uid = md5(uniqid(time()));
$header = "From: " . MAILFROM_ADDRESS . "\r\n"
. "MIME-Version: 1.0\r\n"
. "Content-Type: multipart/mixed; charset=utf-8; boundary=\"" . $uid . "\"\r\n\r\n"
. "This is a multi-part message in MIME format.\r\n\r\n"
. "--" . $uid . "\r\n"
. "Content-Type: text/html; charset=utf-8"."\r\n"
. "Content-Transfer-Encoding: 8bit"."\r\n\r\n"
. $message . "\r\n\r\n";
foreach($files as $file){
$header.= "--" . $uid . "\r\n"
. "Content-Type: plain/text; charset=utf-8; name=\"".$file['name']."\"\r\n"
. "Content-Transfer-Encoding: base64\r\n"
. "Content-Disposition: attachment; filename=\"".$file['name']."\"\r\n\r\n"
. $file['content'] . "\r\n\r\n";
}
$header.= "--" . $uid . "--";
self::sendMail($to, $subject, "", $header);
}
}
WebSVN
- freenet-router
- Blame
- Rev 2
- /trunk/freenet-router/var/www/freenet-router/Framework/Mailer.php
freenet-router |
Subversion Repositories: |
[/] [trunk/] [freenet-router/] [var/] [www/] [freenet-router/] [Framework/] [Mailer.php] - Blame information for rev 2
Powered by WebSVN 2.2.1