Author: Frederik Holljen
Date: 2006-01-27 14:51:43 +0100 (Fri, 27 Jan 2006)
New Revision: 2061

Log:
- Update to runable examples style

Added:
   packages/Mail/trunk/docs/tutorial_autoload.php
   packages/Mail/trunk/docs/tutorial_example_01.php
   packages/Mail/trunk/docs/tutorial_example_02.php
   packages/Mail/trunk/docs/tutorial_example_03.php
   packages/Mail/trunk/docs/tutorial_example_04.php
   packages/Mail/trunk/docs/tutorial_example_05.php
   packages/Mail/trunk/docs/tutorial_example_06.php
Modified:
   packages/Mail/trunk/docs/tutorial.txt

Modified: packages/Mail/trunk/docs/tutorial.txt
===================================================================
--- packages/Mail/trunk/docs/tutorial.txt       2006-01-27 13:47:44 UTC (rev 
2060)
+++ packages/Mail/trunk/docs/tutorial.txt       2006-01-27 13:51:43 UTC (rev 
2061)
@@ -47,18 +47,11 @@
 -----------------------------
 
 Sending a mail using the composer is very straightforward. This small example
-displays how to send a normal text message. ::
+displays how to send a normal text message.
 
-  $mail = new ezcMailComposer();
-  $mail->from = new ezcMailAddress( '[EMAIL PROTECTED]', 'Adrian Ripburger' );
-  $mail->addTo( new ezcMailAddress( '[EMAIL PROTECTED]', 'Maureen Corley' ) );
-  $mail->subject = "This is the subject of the example mail";
-  $mail->plainText = "This is the body of the example mail.";
-  $mail->build();
-  $transport = new ezcMailTransportMta();
-  $transport->send( $mail );
+.. include:: tutorial_example_01.php
+   :literal:
 
-
 An example with HTML text, images and attachments can be found in the
 ezcMailComposer class description.
 
@@ -68,28 +61,16 @@
 The class structure of the mail component follows that of the mail MIME. This
 means that you can build advanced MIME messages part by part.
 
-The first example displays how to build a similar message to the one above. ::
+The first example displays how to build a similar message to the one above.
 
-  $mail = new ezcMail();
-  $mail->from = new ezcMailAddress( '[EMAIL PROTECTED]', 'Boston Low' );
-  $mail->addTo( new ezcMailAddress( '[EMAIL PROTECTED]', 'Maggie Robbins' ) );
-  $mail->subject = "This is the subject of the example mail";
-  $mail->body = new ezcMailText( "This is the body of the example mail." );
-  $transport = new ezcMailTransportMta();
-  $transport->send( $mail );
+.. include:: tutorial_example_02.php
+   :literal:
 
 As you can see there is not much difference with the composer version. In the
-next example we will add an attachment to our manually built mail: ::
+next example we will add an attachment to our manually built mail:
 
-  $mail = new ezcMail();
-  $mail->from = new ezcMailAddress( '[EMAIL PROTECTED]', 'Bernard Bernoulli' );
-  $mail->addTo( new ezcMailAddress( '[EMAIL PROTECTED]', 'Wendy' ) );
-  $mail->subject = "This is the subject of the example mail";
-  $textPart = new ezcMailText( "This is the body of the example mail." );
-  $fileAttachment = new ezcMailFile( "~/myfile.jpg" );
-  $mail->body = new ezcMailMultipartMixed( $textPart, $fileAttachment );
-  $transport = new ezcMailTransportMta();
-  $transport->send( $mail );
+.. include:: tutorial_example_03.php
+   :literal:
 
 The file 'myfile.jpg' must of course exist in order for this example to work.
 
@@ -107,24 +88,11 @@
 require to extra headers that are separated by the normal headers in the
 e-mail.
 
-To make it work we will create the class RFC822Digest that adds these headers: 
::
+To make it work we will create the class RFC822Digest that adds these headers:
 
-  class RFC822Digest extends ezcMailPart
-  {
-      private $mail = null;
-      public function __construct( ezcMail $mail )
-      {
-          $this->mail = $mail;
-          $this->setHeader( 'Content-Type', 'message/rfc822' );
-          $this->setHeader( 'Content-Disposition', 'inline' );
-      }
+.. include:: tutorial_example_04.php
+   :literal:
 
-      public function generateBody()
-      {
-          return $this->mail->generate();
-      }
-  }
-
 Our new class extends the ezcMailPart class. This is required for all parts of
 a mail. ezcMailPart provides two important methods that we can override:
 generateHeaders() and generateBody(). These two methods are called in
@@ -135,17 +103,11 @@
 since we want to include the full text of the mail digest.
 
 The new class can be used directly when building an email. The example assumes
-that a valid ezcMail object is available in the $digest variable. ::
+that a valid ezcMail object is available in the $digest variable.
 
-  $mail = new ezcMail();
-  $mail->from = new ezcMailAddress( '[EMAIL PROTECTED]', 'Largo LaGrande' );
-  $mail->addTo( new ezcMailAddress( '[EMAIL PROTECTED]', 'Wally B. Feed' ) );
-  $mail->subject = "This is the subject of the mail with a mail digest.";
-  $textPart = new ezcMailText( "This is the body of the mail with a mail 
digest." );
+.. include:: tutorial_example_05.php
+   :literal:
 
-  $mail->body = new ezcMailMultipartMixed( $textPart, new RFC822Digest( 
$digest ) );
-  $transport = new ezcMailTransportMta();
-  $transport->send( $mail );
 
 Character encoding
 ------------------
@@ -154,16 +116,10 @@
 character encoding to display their mail correctly.
 
 The following example shows how to send a mail entirely encoded with
-iso-8859-1: ::
+iso-8859-1:
 
-  $mail = new ezcMail();
-  $mail->from = new ezcMailAddress( '[EMAIL PROTECTED]', 'Norwegian 
characters: æøå', 'iso-8859-1' );
-  $mail->addTo( new ezcMailAddress( '[EMAIL PROTECTED]', 'More norwegian 
characters: æøå', 'iso-8859-1' ) );
-  $mail->subject = 'Oslo ligger sør i Norge og har vært landets hovedstad i 
over 600 år.';
-  $mail->subjectCharset = 'iso-8859-1';
-  $mail->body = new ezcMailText( 'Oslo be grunnlagt rundt 1048 av Harald 
Hardråde.', 'iso-8859-1' );
-  $transport = new ezcMailTransportMta();
-  $transport->send( $mail );
+.. include:: tutorial_example_06.php
+   :literal:
 
 You can of course choose and combine any available character set. Make sure
 that the input text is in the encoding specified or you may get unexpected

Added: packages/Mail/trunk/docs/tutorial_autoload.php
===================================================================
--- packages/Mail/trunk/docs/tutorial_autoload.php      2006-01-27 13:47:44 UTC 
(rev 2060)
+++ packages/Mail/trunk/docs/tutorial_autoload.php      2006-01-27 13:51:43 UTC 
(rev 2061)
@@ -0,0 +1,17 @@
+<?php
+
+require_once 'Base/trunk/src/base.php';
+
+/**
+ * Autoload ezc classes 
+ * 
+ * @param string $class_name 
+ */
+function __autoload( $class_name )
+{
+    if ( ezcBase::autoload( $class_name ) )
+    {
+        return;
+    }
+}
+?>


Property changes on: packages/Mail/trunk/docs/tutorial_autoload.php
___________________________________________________________________
Name: svn:eol-style
   + native

Added: packages/Mail/trunk/docs/tutorial_example_01.php
===================================================================
--- packages/Mail/trunk/docs/tutorial_example_01.php    2006-01-27 13:47:44 UTC 
(rev 2060)
+++ packages/Mail/trunk/docs/tutorial_example_01.php    2006-01-27 13:51:43 UTC 
(rev 2061)
@@ -0,0 +1,15 @@
+<?php
+include( "tutorial_autoload.php" );
+
+$mail = new ezcMailComposer();
+$mail->from = new ezcMailAddress( '[EMAIL PROTECTED]', 'Adrian Ripburger' );
+$mail->addTo( new ezcMailAddress( '[EMAIL PROTECTED]', 'Maureen Corley' ) );
+$mail->subject = "This is the subject of the example mail";
+$mail->plainText = "This is the body of the example mail.";
+
+$mail->build();
+
+$transport = new ezcMailTransportMta();
+$transport->send( $mail );
+
+?>


Property changes on: packages/Mail/trunk/docs/tutorial_example_01.php
___________________________________________________________________
Name: svn:eol-style
   + native

Added: packages/Mail/trunk/docs/tutorial_example_02.php
===================================================================
--- packages/Mail/trunk/docs/tutorial_example_02.php    2006-01-27 13:47:44 UTC 
(rev 2060)
+++ packages/Mail/trunk/docs/tutorial_example_02.php    2006-01-27 13:51:43 UTC 
(rev 2061)
@@ -0,0 +1,13 @@
+<?php
+include( "tutorial_autoload.php" );
+
+$mail = new ezcMail();
+$mail->from = new ezcMailAddress( '[EMAIL PROTECTED]', 'Boston Low' );
+$mail->addTo( new ezcMailAddress( '[EMAIL PROTECTED]', 'Maggie Robbins' ) );
+$mail->subject = "This is the subject of the example mail";
+$mail->body = new ezcMailText( "This is the body of the example mail." );
+
+$transport = new ezcMailTransportMta();
+$transport->send( $mail );
+
+?>


Property changes on: packages/Mail/trunk/docs/tutorial_example_02.php
___________________________________________________________________
Name: svn:eol-style
   + native

Added: packages/Mail/trunk/docs/tutorial_example_03.php
===================================================================
--- packages/Mail/trunk/docs/tutorial_example_03.php    2006-01-27 13:47:44 UTC 
(rev 2060)
+++ packages/Mail/trunk/docs/tutorial_example_03.php    2006-01-27 13:51:43 UTC 
(rev 2061)
@@ -0,0 +1,15 @@
+<?php
+include( "tutorial_autoload.php" );
+
+$mail = new ezcMail();
+$mail->from = new ezcMailAddress( '[EMAIL PROTECTED]', 'Bernard Bernoulli' );
+$mail->addTo( new ezcMailAddress( '[EMAIL PROTECTED]', 'Wendy' ) );
+$mail->subject = "This is the subject of the example mail";
+$textPart = new ezcMailText( "This is the body of the example mail." );
+$fileAttachment = new ezcMailFile( "~/myfile.jpg" );
+$mail->body = new ezcMailMultipartMixed( $textPart, $fileAttachment );
+
+$transport = new ezcMailTransportMta();
+$transport->send( $mail );
+
+?>


Property changes on: packages/Mail/trunk/docs/tutorial_example_03.php
___________________________________________________________________
Name: svn:eol-style
   + native

Added: packages/Mail/trunk/docs/tutorial_example_04.php
===================================================================
--- packages/Mail/trunk/docs/tutorial_example_04.php    2006-01-27 13:47:44 UTC 
(rev 2060)
+++ packages/Mail/trunk/docs/tutorial_example_04.php    2006-01-27 13:51:43 UTC 
(rev 2061)
@@ -0,0 +1,19 @@
+<?php
+
+class RFC822Digest extends ezcMailPart
+{
+    private $mail = null;
+    public function __construct( ezcMail $mail )
+    {
+        $this->mail = $mail;
+        $this->setHeader( 'Content-Type', 'message/rfc822' );
+        $this->setHeader( 'Content-Disposition', 'inline' );
+    }
+
+    public function generateBody()
+    {
+        return $this->mail->generate();
+    }
+}
+
+?>


Property changes on: packages/Mail/trunk/docs/tutorial_example_04.php
___________________________________________________________________
Name: svn:eol-style
   + native

Added: packages/Mail/trunk/docs/tutorial_example_05.php
===================================================================
--- packages/Mail/trunk/docs/tutorial_example_05.php    2006-01-27 13:47:44 UTC 
(rev 2060)
+++ packages/Mail/trunk/docs/tutorial_example_05.php    2006-01-27 13:51:43 UTC 
(rev 2061)
@@ -0,0 +1,15 @@
+<?php
+include( "tutorial_autoload.php" );
+
+$mail = new ezcMail();
+$mail->from = new ezcMailAddress( '[EMAIL PROTECTED]', 'Largo LaGrande' );
+$mail->addTo( new ezcMailAddress( '[EMAIL PROTECTED]', 'Wally B. Feed' ) );
+$mail->subject = "This is the subject of the mail with a mail digest.";
+$textPart = new ezcMailText( "This is the body of the mail with a mail 
digest." );
+
+$mail->body = new ezcMailMultipartMixed( $textPart, new RFC822Digest( $digest 
) );
+
+$transport = new ezcMailTransportMta();
+$transport->send( $mail );
+
+?>


Property changes on: packages/Mail/trunk/docs/tutorial_example_05.php
___________________________________________________________________
Name: svn:eol-style
   + native

Added: packages/Mail/trunk/docs/tutorial_example_06.php
===================================================================
--- packages/Mail/trunk/docs/tutorial_example_06.php    2006-01-27 13:47:44 UTC 
(rev 2060)
+++ packages/Mail/trunk/docs/tutorial_example_06.php    2006-01-27 13:51:43 UTC 
(rev 2061)
@@ -0,0 +1,15 @@
+<?php
+include( "tutorial_autoload.php" );
+
+$mail = new ezcMail();
+$mail->from = new ezcMailAddress( '[EMAIL PROTECTED]', 'Norwegian characters: 
æøå', 'iso-8859-1' );
+$mail->addTo( new ezcMailAddress( '[EMAIL PROTECTED]', 'More norwegian 
characters: æøå', 'iso-8859-1' ) );
+$mail->subject = 'Oslo ligger sør i Norge og har vært landets hovedstad i over 
600 år.';
+$mail->subjectCharset = 'iso-8859-1';
+
+$mail->body = new ezcMailText( 'Oslo be grunnlagt rundt 1048 av Harald 
Hardråde.', 'iso-8859-1' );
+
+$transport = new ezcMailTransportMta();
+$transport->send( $mail );
+
+?>


Property changes on: packages/Mail/trunk/docs/tutorial_example_06.php
___________________________________________________________________
Name: svn:eol-style
   + native

-- 
svn-components mailing list
[email protected]
http://lists.ez.no/mailman/listinfo/svn-components

Reply via email to