PHP
  Home arrow PHP arrow Page 2 - 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 - How it Works
    ( Page 2 of 4 )

    I will be using PHP's imap functions to write this client. There are over sixty functions available that you can use to create a mail client for both POP3 and IMAP. Visit http://www.php.net/ to see what functions are available. We will be creating a mail client that supports POP3 because it is by far the most popular mail protocol used today. To send an email message with PHP is very simple. You just use PHP's mail() function. The syntax for the function is:

    mail( string to, string subject, string message [, string
    additional_headers [, string additional_parameters]] )

    But because we want to give the user the choice to send attachments with email, we are going to use the freely available PHPMailer class (from http://phpmailer.sourceforge.net ). This class gives us the power to send email messages with all kinds of features, such as attachments, HTML messages or just plain messages. Although I will be using PHPMailer in this article, I will not be using it extensively, so please look at the following sites to learn more about this class:

    Examples - http://phpmailer.sourceforge.net/extending.html

    Tutorial - http://phpmailer.sourceforge.net/tutorial.html

    To retrieve email messages from the mail server, we will be using the @imap_headerinfo() and imap_msgno( ) functions. The imap_headerinfo() function retrieves all the message headers such as from, subject, and so forth, and the imap_msgno() function identifies the message number as it is numbered on the server.

    To connect to the mail server we use the imap_open($mbox, $userid, $userpassword) function. As you can see this function takes three parameters, the mailbox name, the user name and user password.

    The application will provide the ability to do the following:

    • User authentication.
    • Connect to the mail server and download and process messages.
    • Store the messages in the database one by one.
    • Retrieve and display all the newly downloaded messages.

    After the messages are displayed on the index page, the program will give the user the option to view a message (this will lead to the view.php page) or to delete the message.



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