PHP
  Home arrow PHP arrow Page 3 - PHP Email
Administration  
AJAX  
Apache  
BrainDump  
DHTML  
Flash  
Java  
JavaScript  
Multimedia  
MySQL  
Oracle  
Perl  
PHP  
Practices  
Python  
Reviews  
Security  
Style-Sheets  
Web Services  
XML  
Zend  
Zope  
Forums Sitemap 
IBM® developerWorks 
Sun Developer Network 
E-Commerce Hosting 
Linux Web Hosting 
Managed Hosting 
Small Business Hosting 
Mobile Linux 
App Generation ROI 
VPS Hosting 
Weekly Newsletter

 
Developer Updates  
Free Website Content 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us Get Paid 
Request Media Kit
Contact Us 
Site Map 
Privacy Policy 
Support 
 USERNAME
 
 PASSWORD
 
 
  >>> SIGN UP!  
  Lost Password? 
PHP

PHP Email
By: Leidago
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 4 stars4 stars4 stars4 stars4 stars / 10
    2006-10-25

    Table of Contents:
  • PHP Email
  • How it Works
  • The Database
  • More Tables

  • Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      Del.ici.ous Digg
      Blink Simpy
      Google Spurl
      Y! MyWeb Furl
    Email Me Similar Content When Posted
    Add Developer Shed Article Feed To Your Site
    Email Article To Friend
    Print Version Of Article
    PDF Version Of Article
     
     
    ADVERTISEMENT


    PHP Email - The Database


    (Page 3 of 4 )

    When the application downloads messages from the server, it will immediately send them to the database and then retrieve them to show on the index page. So in effect, you will be viewing messages that are retrieved from a database instead of messages that are directly downloaded from a mail server.

    In addition to storing messages, the database will be used to store all messages that are classed as trash, drafts and sent items. So as you can appreciate, the database is very important to this application. Below I've listed all of the tables (along with the appropriate pieces of code) that are used by this application.

    The contacts table will contain the names and email addresses of your contacts. It is linked to the users table through the userid foreign key, called "userid":

    CREATE TABLE `contacts` (
      `contact_id` int(11) NOT NULL auto_increment,
      `name` varchar(100) NOT NULL default '',
      `email` varchar(100) NOT NULL default '',
      `userid` int(11) NOT NULL default '0',
      PRIMARY KEY  (`contact_id`)
    ) TYPE=MyISAM AUTO_INCREMENT=3 ;
    INSERT INTO `contacts` VALUES (1, 'Joe Blogg', 'admin@mysite',
    1);
    INSERT INTO `contacts` VALUES (2, 'Joe Bloggs', 'admin@bloggs.com', 1);

    Next, the calendar table is used to store information about dates and times for events. The user is connected to this table by the foreign key called "userid." This ensures that only entries made by this user are retrieved when requested.

    CREATE TABLE `calendar` (
      `userid` int(11) NOT NULL default '0',
      `calendar_id` int(11) NOT NULL auto_increment,
      `cal_date` date NOT NULL default '0000-00-00',
      `entry` text NOT NULL,
      PRIMARY KEY  (`calendar_id`)
    )  TYPE=MyISAM AUTO_INCREMENT=3 ;

    INSERT INTO `calendar` VALUES (1, '2005-12-08', 'This encompasses more than the OED definition of a conflict as "a state of opposition or hostilities" or the "clashing of opposed principles". Horowitz's definition includes the desire to achieve something by the struggle, as well as the need for prevailing over an 'other': both elements of ethnic conflict. rnrnThere are a great many theories attempting to explain why groups find themselves in conflict situations. With ethnic groups in particular, why is it so difficult to find resolutions before violence occurs, and why are people so willing to give up so much, often their lives, for their ethnic group? This presentation deals with conflict between ethnic groups primarily, and it is for ethnic groups that this phenomenon of putting the interests of the group before those of the individual is so widespread. rn');

    INSERT INTO `calendar` VALUES (2, '2005-12-28', 'This encompasses more than the OED definition of a conflict as "a state of opposition or hostilities" or the "clashing of opposed principles". Horowitz's definition includes the desire to achieve something by the struggle, as well as the need for prevailing over an 'other': both elements of ethnic conflict. rnrnThere are a great many theories attempting to explain why groups find themselves in conflict situations. With ethnic groups in particular, why is it so difficult to find resolutions before violence occurs, and why are people so willing to give up so much, often their lives, for their ethnic group? This presentation deals with conflict between ethnic groups primarily, and it is for ethnic groups that this phenomenon of putting the interests of the group before those of the individual is so widespread. rn');

    The purpose of the Drafts table is to store all the mail messages that you want to write but don't want to send immediately.  It also links the user through the foreign key.

    CREATE TABLE `drafts` (
      `draft_id` int(11) NOT NULL auto_increment,
      `to` int(200) NOT NULL default '0',
      `from` varchar(100) NOT NULL default '',
      `subject` varchar(200) NOT NULL default '',
      `msg_body` text NOT NULL,
      `userid` int(11) NOT NULL default '0',
      `cc` varchar(100) NOT NULL default '',
      `bcc` varchar(100) NOT NULL default '',
      `attachment` varchar(200) NOT NULL default '',
      PRIMARY KEY  (`draft_id`)
    ) TYPE=MyISAM AUTO_INCREMENT=1 ;

    More PHP Articles
    More By Leidago


       · This article assumes you are using php on Windows. Good luck getting php imap...
       · Yes i'm using windows on my development machine. Unfortunatly i dont have access to...
       · please continue this php email tutorial.it help me.
       · why assign int (11) for " to "?why assign varchar (200) for "from" ?
     

       

    PHP ARTICLES

    - Working With Different Namespaces in PHP 5
    - User Management Explained: Overview
    - Using Namespaces in PHP 5
    - Database Security: Guarding Against SQL Inje...
    - Building a Modular Exception Class in PHP 5
    - Database and Password Security for Web Appli...
    - Handling MySQL Data Set Failures in PHP 5
    - Building Site Registration for Web Applicati...
    - Intercepting Customized Exceptions in PHP 5
    - Securing Your Web Application Against Attacks
    - Sub Classing Exceptions in PHP 5
    - Authentication for Web Application Security
    - Building a Content Management System with Co...
    - Filters and Login Systems for Web Applicatio...
    - Working with the Email Class in Code Igniter





    © 2003-2008 by Developer Shed. All rights reserved. DS Cluster 1 hosted by Hostway
    Stay green...Green IT