Location: PHPKode > scripts > XS PHP Library > xs-php-library/src/mail.php
<?php
//
// +--------------------------------------------------------------------------+
// |                                                                          |
// |                   XS PHP Library  Generic Classes Library                |
// |                                                                          |
// |                   Copyright (c) 2001-2002 XSPHPLib Group.                |
// |                                                                          |
// +--------------------------------------------------------------------------+
// |                                                                          |
// | Distributed under the terms of the GNU Lesser General Public License as  |
// | published by the Free Software Foundation version 2.1                    |
// | See the GNU Lesser General Public License for more details. You should   |
// | have received a copy of the GNU Lesser General Public License along with |
// | this package; if not, write to the Free Software Foundation, Inc.,       |
// | 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.                 |
// |                                                                          |
// +--------------------------------------------------------------------------+
// |                                                                          |
// | Authors: Robert Bala <hide@address.com>                                   |
// |                                                                          |
// +--------------------------------------------------------------------------+
//
// $Id: mail.php,v 1.2 2002/11/28 09:51:38 rbala Exp $

include_once('../inc/object.inc.php');
include_once('../inc/mime.inc.php');
include_once('../inc/mail.inc.php');

$message = new Mail('multipart', 'mixed');

object_checkError($message->setFrom('hide@address.com'));
object_checkError($message->setTo('hide@address.com'));
object_checkError($message->setCc('hide@address.com, hide@address.com'));
object_checkError($message->setBcc('hide@address.com, hide@address.com'));

$message->setSubject('Sample MIME message');

$message->setHeader('x-mailer', 'Sample mailer');

$subpart1 =& $message->addMimePart('part1', 'text', 'plain');

$subpart1->setEncoding(MIME_ENCODING_7BIT);

$subpart1->setMimeParam('charset', 'iso-8859-1');
$subpart1->setContent('This is Subpart text message body....');
$subpart1->setDescription('Sample text message.');

$subpart2 =& $message->addMimePart('part2', 'text', 'plain');

$subpart2->setEncoding(MIME_ENCODING_BASE64);

$subpart2->setMimeParam('filename', 'README');
$subpart2->setContent('../README');
$subpart2->setDescription('Sample attached file.');

$subpart2->setDisposition('attachment');

echo "<pre>\r\n";
echo $message->mailHeaders();
echo "\r\n";
echo $message->mailMessage();
echo "</pre>\r\n";

?>
Return current item: XS PHP Library