Source for file mail.class.php
Documentation is available at mail.class.php
* test case for mail wrapper
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
* @author m2mtech <tech@m2m.at>
* @copyright 2007 m2m server software gmbh
* @license http://www.gnu.org/licenses/gpl.html GNU General Public License Version 2
* @version $Id: mail.class.php 138 2007-08-29 12:13:55Z m2mtech $
* @link http://www.ea-geier.at/
require_once('code/base/mail.class.php');
* tast case for mail wrapper
$this->UnitTestCase('Test Mail Wrapper');
* start FakeMail server & remove old mails
if (exec('ps ax | grep fakemail', $output)) {
foreach ($output as $line) {
$command = 'kill ' . $match[0];
sleep(1); // server does not start up fast enough
* stop FakeMail server & remove mails
$command = 'kill ' . $this->pid;
* delete temporary test mails
if (!is_dir($dir)) return false;
if (!$dh = opendir($dir)) return false;
while (($file = readdir($dh)) !== false) {
if (!strpos($file, '@')) continue;
$mail = new eaMail('dummyhost', 25);
$this->assertTrue($mail->error);
$this->assertFalse($mail->error);
* tests send, to, from, bcc, cc, subject, text
$this->assertFalse($mail->send());
$mail->subject('TestMail');
$this->assertFalse($mail->send());
$mail->text("testemail test content\ntesteamil test content");
$this->assertFalse($mail->send());
$mail->to('testTo@ea-geier.at', 'testTo');
$mail->cc('testCc@ea-geier.at');
$mail->bcc('testBcc@ea-geier.at');
$this->assertFalse($mail->send());
$mail->from('testFrom@ea-geier.at');
$this->assertTrue($mail->send());
|