Thomas

In terms of performance it would not be a good idea to load
Zend_Mail_Transport_Sendmail automatically when you load Zend_Mail.

The reason is that a developer may want to use another Transport and it
would be inefficient to include _Sendmail automatically.

The include on line 723 is done when no transport is defined by the
developer.

You are defining your transport so you need to include statement.

Michael DePetrillo
[EMAIL PROTECTED]
Mobile: (858) 761-1605


On Fri, Nov 28, 2008 at 3:24 PM, Thomas D. <[EMAIL PROTECTED]> wrote:

> Hello,
>
> I am new to Zend Framework.
>
> I tried to send an e-mail using Zend_Mail. I used your example [1], here's
> my code:
>
> <?php
> require_once('Zend/Mail.php');
>
> // Set-up transporter
> $tr = new Zend_Mail_Transport_Sendmail('[EMAIL PROTECTED]');
>
> $mail = new Zend_Mail();
> $mail->setBodyText('This is the text of the mail.');
> $mail->setFrom('[EMAIL PROTECTED]', 'Some Sender');
> $mail->addTo('[EMAIL PROTECTED]', 'Some Recipient');
> $mail->setSubject('TestSubject');
> $mail->send($tr);
> ?>
>
> Running this script will end in this error message:
>
> Fatal error: Class 'Zend_Mail_Transport_Sendmail' not found in
> /data/www/testweb/public_html/zendmail-test.php on line 4
>
> When I add the line
>
> require_once('Zend/Mail/Transport/Sendmail.php');
>
> before the "new Zend_Mail_Transport_Sendmail" call, everything is working.
>
> And that's the question:
> Is that a wanted behavior/design?
>
> I am new to Zend Framework, I would expect that it should be enough to just
> include "Zend/Mail.php".
>
> Also in line 723 in "Zend/Mail.php" there is a include... but it's too
> late.
>
> Actual I don't understand, why you didn't include it with the other files
> in
> line 26-41.
>
>
> See also:
> =========
> [1] http://framework.zend.com/manual/en/zend.mail.html
>
>
> --
> Regards,
> Thomas
>
>
>

Reply via email to