Home arrow PHP arrow Coding Folders for a PHP Email Application

Coding Folders for a PHP Email Application

In this article, the fourth and final one of our series covering the creation of a PHP email application, we are going to look at the code for some of the remaining pages of the mail application. Chief among these is the NewMsg.php page, which is where items, to be more precise, new messages, are either saved as drafts or saved as sent messages.

TABLE OF CONTENTS:
  1. Coding Folders for a PHP Email Application
  2. Form Data
  3. Explaining Sections B and C
  4. The Sent, Trash and Drafts Folders
By: Leidago
Rating: starstarstarstarstar / 8
November 15, 2006

print this article
SEARCH DEV SHED

TOOLS YOU CAN USE

advertisement

Let's see how this one script affects the other ones. Here's an illustrative diagram:

NewMsg.php - > Sent message

         |____________________

         |                                       |

Drafts Folder                       Sent Message FolderOptional

Let's start with the NewMsg page. First you are presented with a form that will take the following input: To, Cc, BCc, Subject, Attachment and message text. All of these are required to send a valid email message.

<table width="100%" border="0" class="block">

        <tr>

          <td width="10%" valign="top"><strong>To</strong></td>

          <td width="90%"><input name="to" type="text" id="to"
size="70"  value="<? if(isset($r['to'])){

                          $r['to'];} ?>"/></td>

        </tr>

        <tr>

          <td valign="top"><strong>Cc</strong></td>

          <td><input name="cc" type="text" id="cc" size="70"
value="<? if(isset($r['cc'])){

                          $r['cc'];} ?>"/></td>

        </tr>

        <tr>

          <td valign="top"><strong>Bcc</strong></td>

          <td><input name="bcc" type="text" id="bcc" size="70"
value="<? if(isset($r['bcc'])){

                          $r['bcc'];} ?>"/></td>

        </tr>

        <tr>

          <td valign="top"><strong>Subject</strong></td>

          <td><input name="sub" type="text" id="sub" size="80"  value="<? if(isset($r['subject'])){

                          $r['subject'];} ?>"/></td>

        </tr>

        <tr>

          <td valign="top"><strong>Attachment</strong></td>

          <td>

                          <input name="userfile" type="file"
id="userfile" size="80" value="<? if(isset($r['attachment'])){

                          $r['attachment'];} ?>"/></td>

        </tr>

        <tr>

          <td valign="top"><strong>Message:</strong></td>

          <td><? $checked = false;

                          if($checked){ ?>

                          <textarea name="msg" cols="90" rows="9"
id="msg"><? if(isset($r['msg_body'])){

                          $r['msg_body'];} } ?></textarea>

                          <? if($checked){

// Automatically calculates the editor base path based on the
_samples directory.

// This is useful only for these samples. A real application
should use something like this:

// $oFCKeditor->BasePath = '/FCKeditor/' ;   // '/FCKeditor/' is
the default value.

$sBasePath ='fckeditor/fckeditor.php';

$oFCKeditor = new FCKeditor('FCKeditor1') ;

$oFCKeditor->BasePath         = $sBasePath ;

$oFCKeditor->Value               = 'This is some <strong>sample
text</strong>. You are using <a
href="http://www.fckeditor.net/">FCKeditor</a>.' ;

$oFCKeditor->Create() ;

}

?>

                          </td>

        </tr>

        <tr>

          <td>&nbsp;</td><*/span>

          <td><input type="submit" name="Submit" value="Send
Message" />

            <input name="draft" type="submit" id="draft"
value="Save As Draft" />

            <input name="save" type="checkbox" id="save"
value="checkbox" />

            Save Sent Message</td>

        </tr>

      </table>

The text in red shows a selection of choices. The first choice is to just send the message as is. The second gives you the option of  saving the message as a draft, and the third choice gives you the option of saving the message in the "Sent Messages" Folder. Some of these choices can be made simultaneously and others cannot. For example, if you click on "save as draft" then the message will be saved in the drafts folder instead of being sent. On the other hand, if you want to send the message and save it in the sent folder, that is allowed.



 
 
>>> More PHP Articles          >>> More By Leidago
 

blog comments powered by Disqus
escort Bursa Bursa escort Antalya eskort
   

PHP ARTICLES

- Hackers Compromise PHP Sites to Launch Attac...
- Red Hat, Zend Form OpenShift PaaS Alliance
- PHP IDE News
- BCD, Zend Extend PHP Partnership
- PHP FAQ Highlight
- PHP Creator Didn't Set Out to Create a Langu...
- PHP Trends Revealed in Zend Study
- PHP: Best Methods for Running Scheduled Jobs
- PHP Array Functions: array_change_key_case
- PHP array_combine Function
- PHP array_chunk Function
- PHP Closures as View Helpers: Lazy-Loading F...
- Using PHP Closures as View Helpers
- PHP File and Operating System Program Execut...
- PHP: Effects of Wrapping Code in Class Const...

Developer Shed Affiliates

 


Dev Shed Tutorial Topics: