PHP
  Home arrow PHP arrow Page 3 - PHP Email
Dev Shed Forums  
Administration  
AJAX  
Apache  
BrainDump  
DHTML  
Flash  
Java  
JavaScript  
Multimedia  
MySQL  
Oracle  
Perl  
PHP  
Practices  
Python  
Reviews  
Security  
Smartphone Development  
Style-Sheets  
Web Services  
XML  
Zend  
Zope  
Mobile Linux  
App Generation ROI  
IBM® developerWorks  
Forums Sitemap  
E-Commerce Hosting  
Linux Web Hosting  
Managed Hosting  
Small Business Hosting  
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? 
Google.com  
PHP

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


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

  • Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      error-file:tidyout.log Del.ici.ous error-file:tidyout.log Digg
      error-file:tidyout.log Blink error-file:tidyout.log Simpy
      error-file:tidyout.log Google error-file:tidyout.log Spurl
      error-file:tidyout.log Y! MyWeb error-file:tidyout.log 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
     

       

    PHP ARTICLES

    - Implementing Factory Methods in PHP 5
    - Merging a File Split for FTP Upload using PHP
    - Getting Data from Yahoo Site Explorer Inboun...
    - Method Chaining: Adding More Selecting Metho...
    - How to Split a File During an FTP Upload Usi...
    - Expanding a Custom CodeIgniter Library with ...
    - Using the Yahoo Site Explorer Inbound Links ...
    - Building a CodeIgniter Custom Library with M...
    - Building an E-mini Trading System Using PHP ...
    - Completing the MySQL Class with Method Chain...
    - Building Dynamic Queries with Chainable Meth...
    - PHP Encryption and Decryption Methods
    - Building a MySQL Abstraction Class with Meth...
    - Completing a Sample String Processor with Me...
    - Mastering WHILE Loops for PHP and MySQL





    © 2003-2009 by Developer Shed. All rights reserved. DS Cluster 5 Hosted by Hostway
    For more Enterprise Application Development news, visit eWeek