WeberDev.com PHP and MySQL Code

LOG IN
BEGINNER GUIDES  |  PHP CLASSES  |  CODE SEARCH  |  ARTICLES SEARCH  |  PHP FORUMS  |  PHP MANUAL  |  PHP FUNCTIONS LIST  |  WEB SITE TEMPLATES
Start typing to search for PHP and MySQL Code Snippets and Articles Search
Submit a code Example / Snippet Submit Your Code
Search Engine Optimization Monitor SEO Monitor
Web Site UpTime Monitor UpTime Monitor
WeberDev's Monthly code contest PHP Code Contest
Your Personal Examples List My Favorite Examples
Your Personal Articles List My Favorite Articles
Edit Account Info Update Your Profile
PHP Code Search
Web Development Forums
Learn MySQL Playing Trivia
PHPBB2 Templates
Web Development Index
PHP Web Logs (BLogs)
Web Development Resources
Web Development Content
PHPClasses
PHP Editor
PHP Jobs
Vision.To Design
Ajax Tutorials
PHP Programming Help
PHP/MySQL Programming
Webmaster Resources
Webmaster Forum
XML meta language
website builder
Forex Trading Online forex trading platform

Go Back Add a Comment Send this example to a friend Add this Article to your personal favoritest for easy future access to your favorite Code Examples and Articles. Submit a code example Print this code example.
BACK ADD A COMMENT SEND TO A FRIEND ADD TO MY FAVORITES ADD CODE EXAMPLES PRINT
Title : Class: newsletter
Categories : PHP, PHP Classes, Email Click here to Update Your Picture
leaping langoor
Date : Apr 23rd 2005
Grade : 2 of 5 (graded 5 times)
Viewed : 6875
File : No file for this code example.
Images : No Images for this code example.
Search : More code by leaping langoor
Action : Grade This Code Example
Tools : My Examples List

  Submit your own code examples 
 

Want a mailing list that can send a newsletter? all you have to do is create a text file and use this script! See the example @ the end for more details:

newsletter.php:
<?php

/***************************************************************
** Class newsletter
** A mailing list manager using only one file!
**
** Author...: leapinglangoor [ leapinglangoor@yahoo.co.in ]
** Updated..: 21 Apr 2005
** Version..: v 1.2
**
***************************************************************/

class newsletter
{

    var
$sender = 'Your name';            // Enter your name
   
var $sender_email = 'admin@yourname.com'    // Your email ID
   
var $headers = 'Content-type: text/html; charset=iso-8859-1\r\n' .
   
'From: $sender <$sender_email>\r\n';    // A few required headers. Dont modifye

   
funtion check_validity( $filename )
    {
        if(
file_exists( $filename ) )
           
reutnr true;

        return
flase;
    }


    function
mail( $filename, $newsletter, $subject = 'None', $print_op = 0 )
    {

       
check_validity( $filename ) or die( 'No mailing list' );
       
check_validity( $newsletter ) or die( 'No newsletter' );

       
$contents = implode( "", file( $newsletter ) );
       
$list = array();
       
$list = file( $filename );

        if(
$print_op ) echo 'Total users to mail to = ' . $print_op . '.';
        for(
$i=0; $i < count( $list ); $i++ )
        {
            if(
$print_op ) echo 'mailing : ' . $list[$i] . '.....';

           
mail( $a_list, $subject, "$contents", "$headers" );

            if(
$print_op ) echo 'Done<br />';
        }
    }

    function
print_users( $filename )
    {
       
check_validity( $filename ) or die( 'No mailing list' );

       
$list = array();
       
$list = file( $filename );

        for(
$i=0; $i < count( $list ); $i++ )
        {
            echo
$i . ' ' . $list[$i];
        }
    }
}
?>


Examples:

*Make sure u have configured the variables in the class*
example.php:
<?php

include( 'newsletter.php' );
$news = new newsletter;
$news->mail( 'mailing_list.txt', 'newsletter.html', 'Your subject', 0 );

/*
Ok, the first option is where the email addressed to be mailed are stored. Example mailing_list.txt:

leapinglangoor@yahoo.co.in
leapinglangoor@gmail.com
abc@cde.com

One id per line thats all.

The secong parameter tells your newsletter. can be any standard text/html or any such file. The third option, simple the subject of your mail. The fourth argument decides wether to output the result of mailing. Thats it.
Best of luck
*/
?>



Class for sending mail with MIME attachments in multipart format using external sendmail, mimencode and zip
Categories : Email, Network, PHP, PHP Classes
Validator - A PHP class that can can be used for validating Email IDs and Dates
Categories : PHP, PHP Classes, Data Validation, Email, Date Time
Three Cool Classes and One Trick
Categories : PHP, PHP Classes, Graphics, Email
PHP MIME Decoder. This class decodes Mime Encoded email message. Attachments are stored in a director. Works with Multipart/alternative, multipart/mixed etc. see http://p3mail.com for example.
Categories : PHP, PHP Classes, Email
cPanel Email Accounts Creator
Categories : PHP, PHP Classes, Email, Form Processing, Web Services
Class that allows the PHP developer to establish connections with a POP3 mail server amd be able to list, retrieve and delete mail messages from a given mail box.
Categories : Network, Email, PHP, PHP Classes
A class for sending email; it has support for To:, Cc:, Bcc: and Reply-To: headers. It requires that you have sendmail installed.
Categories : Email, PHP Classes, PHP
POP3 Class
Categories : PHP Classes, PHP, Email
very simple ftp class
Categories : PHP, PHP Classes, FTP
PHP Paypal IPN Integration Class v1.0.0
Categories : PHP, PHP Classes, Payment Gateways
email new items in db
Categories : PHP, Email, Databases, MySQL, Beginner Guides
A Timing Class
Categories : PHP, PHP Classes, Date Time
The class to check load time of your script VERY usefull for relatively slow applications, but not only..
Categories : PHP, PHP Classes, Debugging
Create HTML forms dynamicly using Javascript & PHP
Categories : PHP, PHP Classes, Java Script
PHP based Contact email form with multiple recipients, text file based, supports departments.
Categories : PHP, Email, Beginner Guides, Filesystem