Php Codes
Algorithms
Arrays
Authentication
Calendar
Code Snippets
Programs
Content Manage
Contest Related
Cookies
Credit Cards
DBase Related
Databases
Date Time
Directories
E-Mail
Errors
File
File System
Forms
Handling
Graphics
HTML and PHP
Informix
Ingres
InterBase
LDAP
Look and Feel
Miscellaneous
MySQL
Other
PHP Classes
Searching
Navigation
Statistics
Strings
User Manage
Php > E-Mail sample source codes
Campaign Mailer - Allows sending emails to a mailing list with multiple classes
Campaign Mailer - Allows sending emails to a mailing list with multiple classes of emails handled. Suitable for mailing campaigns. boundary = md5( uniqid( time( ))); $this->sender = "From: {$name} <{$mail}>\r\n"; } function setTo( $mail, $vars) { $this->to[$mail] = $vars; } function attachment( $file) { $this->attachment[] = $file; } function setSubject( $name, $subject) { $this->subject[$name] = $subject; } function setBody( $name, $str) { $this->body[$name] = $str; } // function setBody($type, $name, $str) function getBody( $vars) { if ( isset( $vars['class'])) $class = $vars['class']; else $class = 0; if ( isset( $this -> body[$class])) $body = $this -> body[$class]; elseif ( count( $this -> body) > 0) $body = $this -> body[0]; else $body = ''; foreach( $vars as $k => $v) { if ( $k != 'class') $body = str_replace( $k, $v, $body); } return $body; } // function getBody($vars) function getSubject( $class) { if ( empty( $class)) $class = 0; return $this -> subject[$class]; } // function getSubject($class) function addStyle( $html) { // add any styles that you need. Be aware that they may not // be read by the email client the same as a browser $output = "