PHP
  Home arrow PHP arrow Page 4 - 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 - More Tables
    ( Page 4 of 4 )

    The Messages table is at the heart of the application.  It is responsible for storing all the mail messages as they are downloaded from the server. This is where it all begins. The userid identifies the user that is downloading the messages and is stored in the userid foreign key.

    CREATE TABLE `messages` (
      `msg_id` int(11) NOT NULL auto_increment,
      `msg_num` int(11) NOT NULL default '0',
      `from` varchar(100) NOT NULL default '',
      `subject` varchar(200) NOT NULL default '',
      `msg_date` datetime NOT NULL default '0000-00-00 00:00:00',
      `msg_body` text NOT NULL,
      `checked` int(1) NOT NULL default '0',
      `userid` int(11) NOT NULL default '0',
      PRIMARY KEY  (`msg_id`)
    ) TYPE=MyISAM AUTO_INCREMENT=3 ;

    INSERT INTO `messages` VALUES (1, 2, 'admin@lo.com', 'helloooo',
    '2005-12-20 00:00:00', '<h1>Hello Jack</h1><br>rn<br>rn<p>This is a <em>cool</em>
    day</p>rnrn<font color="#FF000">The End</font>', 1, 1);

    INSERT INTO `messages` VALUES (2, 1, 'rach@look.co.uk',
    'hellllllllooooo2', '0000-00-00 00:00:00',
    'dhdghfghdrnfghdfghdfgh', 1, 1);

    The sent and trash tables will store all the sent items and messages classed as trash. Both contain the foreign key that will identify the user of the system.

    CREATE TABLE `sent` (
      `sent_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',
      `date_sent` date NOT NULL default '0000-00-00',
      `cc` varchar(100) NOT NULL default '',
      `bcc` varchar(100) NOT NULL default '',
      `attachment` varchar(255) NOT NULL default '',
      PRIMARY KEY  (`sent_id`)
    )
    CREATE TABLE `trash` (
      ` trash_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',
    attachment` varchar(255) NOT NULL default '',
      PRIMARY KEY  (`trash_id`)
    )

    The "users" table is also another important table. It will help to store user details and will also be used by almost all scripts to retrieve user related information from the database.  The user ID is set at login and is used throughout the application.

    CREATE TABLE `user` (
      `user_id` int(11) NOT NULL auto_increment,
      `uname` varchar(100) NOT NULL default '',
      `upass` varchar(50) NOT NULL default '',
      `email` varchar(90) NOT NULL default '',
      `remuser` varchar(200) NOT NULL default '',
      `rempass` varchar(200) NOT NULL default '',
      `pop3` varchar(200) NOT NULL default '',
      `smtp` varchar(255) NOT NULL default '',
      PRIMARY KEY  (`user_id`)
    ) TYPE=MyISAM AUTO_INCREMENT=3 ;

    INSERT INTO `user` VALUES (1, 'yourname', 'pass', 'me@asite.com',' me@asite.com', 'yourpass', 'mail.asite.com', 'mail.asite.com');

    Copy and paste the above SQL into your database client and run the SQL. All the tables should now be created and ready for use.

    Conclusion

    This was just an introduction to how the application is going to function. In the next article we will deal with the login system.



     
     
    >>> 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 1 Hosted by Hostway
    For more Enterprise Application Development news, visit eWeek