Zend_Mail

8 messages Options
Embed this post
Permalink
cortex-2

Zend_Mail

Reply Threaded More More options
Print post
Permalink
Hi,
 
I used Zend_Mail with sendmail transport class and everything works smoothly inside an action of Zend_Controller.
I then wanted to switch to Smtp transport class and things goes wrong. The mail is correctly sent but it seems that when doing the __destruct function, the smtp transport class wanted to send a "QUIT" message over the socket which is no more a ressource.
In the Zend_Mail_Protocol_Abstract::_send function, the socket is test to be a ressource and the result is false (the reason why, i don't know), thus, it tries to include the "Zend/Mail/Protocol/Exception.php" file. At this point, I have a Fatal Error saying it can't find the file. This file exist and apache has access to it. What is weird is that the include path given with the error is empty while it should contains path (if not the whole site would have not work). Why the include path is empty at this point, i don't know.
 
If I remove the require_once and replace the throw new Zend_Mail_Protocol_Exception with a simple Exception, i got this exception but with no stack frame, so it's difficult to trace.
 
What I supposed is that the destructor is executed by the garbage collector at the end of the script, the socket has been destroyed prior to the call to __destruct and the include path is empty at this stage because the base directory changed to root directory and my relative included path are no more resolved.
Anyways, throwing an exception in a desctructor is not recommended and lead to a fatal error if thrown at the end of the script.
 
To solve this, i call the __destruct function at the end of the _sendMail() function just after having send the mail. I know this may have side effects if the transport class is reused.
 
Any one with the same issue ?
 
Sébastien Crocquesel
Hector Virgen

Re: Zend_Mail

Reply Threaded More More options
Print post
Permalink
Another option would be to unset your mail object after sending, which in turn will call __destruct().

$mail->send();
unset($mail); // destroys object and calls __destruct();

Doing this will prevent the __destruct() method from being called again when the object is destroyed on its own at the end of the script.

-Hector


On Mon, May 4, 2009 at 5:43 AM, Sebastien Crocquesel <[hidden email]> wrote:
Hi,
 
I used Zend_Mail with sendmail transport class and everything works smoothly inside an action of Zend_Controller.
I then wanted to switch to Smtp transport class and things goes wrong. The mail is correctly sent but it seems that when doing the __destruct function, the smtp transport class wanted to send a "QUIT" message over the socket which is no more a ressource.
In the Zend_Mail_Protocol_Abstract::_send function, the socket is test to be a ressource and the result is false (the reason why, i don't know), thus, it tries to include the "Zend/Mail/Protocol/Exception.php" file. At this point, I have a Fatal Error saying it can't find the file. This file exist and apache has access to it. What is weird is that the include path given with the error is empty while it should contains path (if not the whole site would have not work). Why the include path is empty at this point, i don't know.
 
If I remove the require_once and replace the throw new Zend_Mail_Protocol_Exception with a simple Exception, i got this exception but with no stack frame, so it's difficult to trace.
 
What I supposed is that the destructor is executed by the garbage collector at the end of the script, the socket has been destroyed prior to the call to __destruct and the include path is empty at this stage because the base directory changed to root directory and my relative included path are no more resolved.
Anyways, throwing an exception in a desctructor is not recommended and lead to a fatal error if thrown at the end of the script.
 
To solve this, i call the __destruct function at the end of the _sendMail() function just after having send the mail. I know this may have side effects if the transport class is reused.
 
Any one with the same issue ?
 
Sébastien Crocquesel

cortex-2

Re: Zend_Mail

Reply Threaded More More options
Print post
Permalink
That works, thanks

2009/5/5 Hector Virgen <[hidden email]>
Another option would be to unset your mail object after sending, which in turn will call __destruct().

$mail->send();
unset($mail); // destroys object and calls __destruct();

Doing this will prevent the __destruct() method from being called again when the object is destroyed on its own at the end of the script.

-Hector



On Mon, May 4, 2009 at 5:43 AM, Sebastien Crocquesel <[hidden email]> wrote:
Hi,
 
I used Zend_Mail with sendmail transport class and everything works smoothly inside an action of Zend_Controller.
I then wanted to switch to Smtp transport class and things goes wrong. The mail is correctly sent but it seems that when doing the __destruct function, the smtp transport class wanted to send a "QUIT" message over the socket which is no more a ressource.
In the Zend_Mail_Protocol_Abstract::_send function, the socket is test to be a ressource and the result is false (the reason why, i don't know), thus, it tries to include the "Zend/Mail/Protocol/Exception.php" file. At this point, I have a Fatal Error saying it can't find the file. This file exist and apache has access to it. What is weird is that the include path given with the error is empty while it should contains path (if not the whole site would have not work). Why the include path is empty at this point, i don't know.
 
If I remove the require_once and replace the throw new Zend_Mail_Protocol_Exception with a simple Exception, i got this exception but with no stack frame, so it's difficult to trace.
 
What I supposed is that the destructor is executed by the garbage collector at the end of the script, the socket has been destroyed prior to the call to __destruct and the include path is empty at this stage because the base directory changed to root directory and my relative included path are no more resolved.
Anyways, throwing an exception in a desctructor is not recommended and lead to a fatal error if thrown at the end of the script.
 
To solve this, i call the __destruct function at the end of the _sendMail() function just after having send the mail. I know this may have side effects if the transport class is reused.
 
Any one with the same issue ?
 
Sébastien Crocquesel


dmuir

Zend Tool with modules

Reply Threaded More More options
Print post
Permalink
Just trying out the new Zend Tool setup in 1.8.

Does it support modules? The profile xml has provisions for it, but from
what I can tell, there doesn't seem to be a way to create module
controllers/actions.

David
Ulrich Wolf

AW: Zend Tool with modules

Reply Threaded More More options
Print post
Permalink
Module-Support is not available in 1.8.0 as far as I know.

But a few days ago there was a commit for this feature by Ralph Eggert
(http://framework.zend.com/code/changelog/Zend_Framework/?cs=15386) which
will hopefully be included in ZF1.8.1. The related Ticket is 5671
(http://framework.zend.com/issues/browse/ZF-6571).

Uli

> -----Ursprüngliche Nachricht-----
> Von: David Muir [mailto:[hidden email]]
> Gesendet: Dienstag, 12. Mai 2009 07:25
> An: [hidden email]
> Betreff: [fw-core] Zend Tool with modules
>
> Just trying out the new Zend Tool setup in 1.8.
>
> Does it support modules? The profile xml has provisions for it, but
> from
> what I can tell, there doesn't seem to be a way to create module
> controllers/actions.
>
> David

dmuir

Re: AW: Zend Tool with modules

Reply Threaded More More options
Print post
Permalink
Some javascript/style in this post has been disabled (why?)
Cool, thanks.
David

Ulrich Wolf wrote:
Module-Support is not available in 1.8.0 as far as I know.

But a few days ago there was a commit for this feature by Ralph Eggert
(http://framework.zend.com/code/changelog/Zend_Framework/?cs=15386) which
will hopefully be included in ZF1.8.1. The related Ticket is 5671
(http://framework.zend.com/issues/browse/ZF-6571).

Uli

  
-----Ursprüngliche Nachricht-----
Von: David Muir [[hidden email]]
Gesendet: Dienstag, 12. Mai 2009 07:25
An: [hidden email]
Betreff: [fw-core] Zend Tool with modules

Just trying out the new Zend Tool setup in 1.8.

Does it support modules? The profile xml has provisions for it, but
from
what I can tell, there doesn't seem to be a way to create module
controllers/actions.

David
    

  

mikaelkael

Re: AW: Zend Tool with modules

Reply Threaded More More options
Print post
Permalink
In reply to this post by Ulrich Wolf
Ulrich Wolf a écrit :
> Module-Support is not available in 1.8.0 as far as I know.
>
> But a few days ago there was a commit for this feature by Ralph Eggert
>  
Ralph Schindler instead ;)

> (http://framework.zend.com/code/changelog/Zend_Framework/?cs=15386) which
> will hopefully be included in ZF1.8.1. The related Ticket is 5671
> (http://framework.zend.com/issues/browse/ZF-6571).
>
> Uli
>
>  
>> -----Ursprüngliche Nachricht-----
>> Von: David Muir [mailto:[hidden email]]
>> Gesendet: Dienstag, 12. Mai 2009 07:25
>> An: [hidden email]
>> Betreff: [fw-core] Zend Tool with modules
>>
>> Just trying out the new Zend Tool setup in 1.8.
>>
>> Does it support modules? The profile xml has provisions for it, but
>> from
>> what I can tell, there doesn't seem to be a way to create module
>> controllers/actions.
>>
>> David
>>    

Ulrich Wolf

AW: Zend Tool with modules

Reply Threaded More More options
Print post
Permalink
uuups, i'm deeply sorry!

7:25 in the morning and the book of Ralph Eggert next to me are not really a
good combination for sending mails ;)

Thanks for the Hint!

Uli


Mikaelkael wrote:

>Ulrich Wolf a écrit :
>> Module-Support is not available in 1.8.0 as far as I know.
>>
>> But a few days ago there was a commit for this feature by Ralph Eggert
>
>Ralph Schindler instead ;)
>
>> (http://framework.zend.com/code/changelog/Zend_Framework/?cs=15386) which
>> will hopefully be included in ZF1.8.1. The related Ticket is 5671
>> (http://framework.zend.com/issues/browse/ZF-6571).
>>
>> Uli
>>
>>  
>>> -----Ursprüngliche Nachricht-----
>>> Von: David Muir [mailto:[hidden email]]
>>> Gesendet: Dienstag, 12. Mai 2009 07:25
>>> An: [hidden email]
>>> Betreff: [fw-core] Zend Tool with modules
>>>
>>> Just trying out the new Zend Tool setup in 1.8.
>>>
>>> Does it support modules? The profile xml has provisions for it, but
>>> from
>>> what I can tell, there doesn't seem to be a way to create module
>>> controllers/actions.
>>>
>>> David