<?php
/*
Das Script darf grundsätzlich frei genutzt und modifiziert werden, solange der Copyright Hinweiss & Link zu http://www.phplist.de erhalten bleibt.
*/
{
}
require("phpmailer/class.phpmailer.php");
class PHPlistMailer extends PHPMailer {
var $isText = false;
var $WordWrap = 75;
var $encoding = 'base64';
var $image_types =
array(
'gif' => 'image/gif',
'jpg' => 'image/jpeg',
'jpeg' => 'image/jpeg',
'jpe' => 'image/jpeg',
'bmp' => 'image/bmp',
'png' => 'image/png',
'tif' => 'image/tiff',
'tiff' => 'image/tiff',
'swf' => 'application/x-shockwave-flash'
);
function PHPlistMailer($messageid,$email) {
$this->addCustomHeader("X-Mailer: cg-soft.de");
$this->addCustomHeader("X-MessageID: $messageid");
$this->addCustomHeader("X-ListMember: $email");
$this->addCustomHeader("Precedence: bulk");
$this->Host = PHPMAILERHOST;
// $this->Helo = getConfig("website");
// $this->CharSet = getConfig("html_charset");
/*
if (isset($GLOBALS['phpmailer_smtpuser']) && $GLOBALS['phpmailer_smtpuser'] != '') {
$this->SMTPAuth = true;
$this->Username = $GLOBALS['phpmailer_smtpuser'];
$this->Password = $GLOBALS['phpmailer_smtppassword'];
# logEvent('Sending authenticated email via '.PHPMAILERHOST);
}
*/
if ($GLOBALS["message_envelope"]) {
$this->Sender = $GLOBALS["message_envelope"];
$this->addCustomHeader("Errors-To: ".$GLOBALS["message_envelope"]);
}
$this->Mailer = "mail";
# logEvent('Sending via mail');
}
function add_html($html,$text = '',$templateid = 0) {
$this->Body = $html;
$this->IsHTML(true);
if ($text) {
$this->add_text($text);
}
$this->find_html_images_in_content($html);
}
function add_text($text) {
if (!$this->Body) {
$this->IsHTML(false);
$this->Body = $text;
} else {
$this->AltBody = $text;
}
}
function append_text($text) {
if ($this->AltBody) {
$this->AltBody .= $text;
} else {
$this->Body .= $text;
}
}
function build_message() {
}
function send($to_name = "", $to_addr, $from_name, $from_addr, $subject = '', $headers = '',$envelope = '') {
$this->From = $from_addr;
$this->FromName = $from_name;
$this->AddAddress($GLOBALS["developer_email"]);
} else {
$this->AddAddress($to_addr);
}
$this->Subject = $subject;
if(!parent::Send()) {
echo ("Mailer Error: " .
$this->
ErrorInfo);
return 0;
}#
return 1;
}
function add_attachment($contents,$filename,$mimetype) {
$cur =
count($this->
attachment);
$this->attachment[$cur][1] = $filename;
$this->attachment[$cur][2] = $filename;
$this->attachment[$cur][3] = $this->encoding;
$this->attachment[$cur][4] = $mimetype;
$this->attachment[$cur][5] = false;
$this->attachment[$cur][6] = "attachment";
$this->attachment[$cur][7] = 0;
}
function get_template_image_in_content($filename){
$return = '';
if($fp =
fopen($filename,
'rb')){
$return .=
fread($fp,
1024);
}
}else{
return FALSE;
}
}
function find_html_images_in_content($content) {
while(list($key,
) =
each($this->
image_types))
$extensions[] = $key;
for($i=0; $i<count($images[2]); $i++)
{
$html_images[] = $images[2][$i];
}
{
for($i=0; $i<count($html_images); $i++)
{
if($image = $this->get_template_image_in_content($html_images[$i])){
$content_type =
$this->
image_types[substr($html_images[$i],
strrpos($html_images[$i],
'.') +
1)];
$cid =
$this->
add_html_image($image,
basename($html_images[$i]),
$content_type);
}
}
}
}
function find_html_images($templateid) {
while(list($key,
) =
each($this->
image_types))
$extensions[] = $key;
for($i=0; $i<count($images[1]); $i++){
if($this->image_exists($templateid,$images[1][$i])){
$html_images[] = $images[1][$i];
}
}
if(!
empty($html_images)){
for($i=0; $i<count($html_images); $i++){
if($image = $this->get_template_image($templateid,$html_images[$i])){
$content_type =
$this->
image_types[substr($html_images[$i],
strrpos($html_images[$i],
'.') +
1)];
$cid =
$this->
add_html_image($image,
basename($html_images[$i]),
$content_type);
}
}
}
}
function add_html_image($contents, $name = '', $content_type='application/octet-stream') {
$cur =
count($this->
attachment);
$this->attachment[$cur][0] = $contents;
$this->attachment[$cur][1] = '';
$this->attachment[$cur][2] = $name;
$this->attachment[$cur][3] = $this->encoding;
$this->attachment[$cur][4] = $content_type;
$this->attachment[$cur][5] = false;
$this->attachment[$cur][6] = "inline";
$this->attachment[$cur][7] = $cid;
return $cid;
}
function EncodeFile ($path, $encoding = "base64") {
# as we already encoded the contents in $path, return $path
}
}