RE: [fw-general] Zend_Mail SMTP Threading?
Hi Justin, Yes I understand about mail queuing, however: 1. This is a local mail server with no queue (and the logs report 0.00 seconds to queue) 2. The system works without a problem when I use CURL 3. The mail server's logs show that the command to send the message are being received by the server after the commands to view the mail 4. Delaying the checking of the email by up to 10 seconds does not change any of this Cheers, Steven -Original Message- From: Justin Randell [mailto:[EMAIL PROTECTED] Sent: Wednesday, 12 March 2008 11:57 AM To: Steven Brown Cc: 'Bill Karwin'; fw-general@lists.zend.com Subject: Re: [fw-general] Zend_Mail SMTP Threading? Steven Brown wrote: > > It appears as though the local server waits for the SMTP commands to finish > before it returns a result to CURL, whereas directly accessing my bootstrap > allows the SMTP commands to run in the background almost as a separate > thread. i doubt there are any separate threads here. the basic issue is that smtp commands finishing != message delivered to intended recipients mailbox. usually, smtp commands finishing in php code just means the mail server has accepted the message into its queue. so: time a: smtp commands finish in php code time a + n: pop commands run time a + N: message gets to user mailbox if n is greater than N, then your tests will run ok. if not, then they wont. N is not dependent on your scripts or tests, but on an external process - the mail server. so, the simplest thing to do is to make n larger by putting a sleep call in before you run the pop checks. another less simple approach is to use mock objects to represents the mail process. make sense? > Cheers, > Steven cheers justin
RE: [fw-general] Zend_Mail SMTP Threading?
In my bootstrap: Zend_Mail::setDefaultTransport(new Zend_Mail_Transport_Smtp('localhost')); In my controller: $mail = new Zend_Mail(); $mail->setBodyText('Test Message') ->addTo($this->view->user->email) ->setSubject('Test Subject') ->send(); I have modified the subject and message here. -Original Message- From: Simon Mundy [mailto:[EMAIL PROTECTED] Sent: Wednesday, 12 March 2008 11:31 AM To: Steven Brown Cc: fw-general@lists.zend.com Subject: Re: [fw-general] Zend_Mail SMTP Threading? Can you send a snippet of your code used to send your mail? The Zend_Mail SMTP transport is transactional and will process each mail object by direct interaction with the target server, so I can't understand why it is executing parallel with your POP requests. Cheers > I have tried both, with the same result > > -Original Message- > From: Simon Mundy [mailto:[EMAIL PROTECTED] > Sent: Wednesday, 12 March 2008 11:07 AM > To: Steven Brown > Cc: 'Bill Karwin'; fw-general@lists.zend.com > Subject: Re: [fw-general] Zend_Mail SMTP Threading? > > Hi Steve - are you using the regular 'mail' transport or the SMTP > transport when using Zend_Mail? > >> Hi all, >> >> I've been writing some unit tests and have had some trouble with >> mail. >> >> I send mail using my application and then check these emails in my >> unit >> tests. All of this is handled by a local mail server (hMailServer). >> >> If I use CURL to request pages from my local server that send mail, >> the SMTP >> commands of the page all happen before the POP commands of my unit >> tests, so >> the mail is sent, then checked. >> >> If I load my bootstrap in my unit test the SMTP and POP commands are >> mixed >> up, so that not all SMTP commands are finished before POP commands >> are sent. >> This means the account can be checked before the mail has been sent, >> even >> though in the code the sending commands are before the checking >> commands. >> >> This happens whether I use PHP's mail() or Zend_Mail. >> >> It appears as though the local server waits for the SMTP commands to >> finish >> before it returns a result to CURL, whereas directly accessing my >> bootstrap >> allows the SMTP commands to run in the background almost as a >> separate >> thread. >> >> Any ideas on why this is happening? How can I force the SMTP >> commands to >> finish before code execution continues? >> >> Cheers, >> Steven >> >> > > -- > > Simon Mundy | Director | PEPTOLAB > > """ " "" """""" "" "" """"""" " "" """"" " """"" " """""" "" " > > 202/258 Flinders Lane | Melbourne | Victoria | Australia | 3000 > Voice +61 (0) 3 9654 4324 | Mobile 0438 046 061 | Fax +61 (0) 3 9654 > 4124 > http://www.peptolab.com > > > -- Simon Mundy | Director | PEPTOLAB """ " "" """""" "" "" """"""" " "" """"" " """"" " """""" "" " 202/258 Flinders Lane | Melbourne | Victoria | Australia | 3000 Voice +61 (0) 3 9654 4324 | Mobile 0438 046 061 | Fax +61 (0) 3 9654 4124 http://www.peptolab.com
Re: [fw-general] Zend_Mail SMTP Threading?
Steven Brown wrote: It appears as though the local server waits for the SMTP commands to finish before it returns a result to CURL, whereas directly accessing my bootstrap allows the SMTP commands to run in the background almost as a separate thread. i doubt there are any separate threads here. the basic issue is that smtp commands finishing != message delivered to intended recipients mailbox. usually, smtp commands finishing in php code just means the mail server has accepted the message into its queue. so: time a: smtp commands finish in php code time a + n: pop commands run time a + N: message gets to user mailbox if n is greater than N, then your tests will run ok. if not, then they wont. N is not dependent on your scripts or tests, but on an external process - the mail server. so, the simplest thing to do is to make n larger by putting a sleep call in before you run the pop checks. another less simple approach is to use mock objects to represents the mail process. make sense? Cheers, Steven cheers justin
Re: [fw-general] Zend_Mail SMTP Threading?
Can you send a snippet of your code used to send your mail? The Zend_Mail SMTP transport is transactional and will process each mail object by direct interaction with the target server, so I can't understand why it is executing parallel with your POP requests. Cheers I have tried both, with the same result -Original Message- From: Simon Mundy [mailto:[EMAIL PROTECTED] Sent: Wednesday, 12 March 2008 11:07 AM To: Steven Brown Cc: 'Bill Karwin'; fw-general@lists.zend.com Subject: Re: [fw-general] Zend_Mail SMTP Threading? Hi Steve - are you using the regular 'mail' transport or the SMTP transport when using Zend_Mail? Hi all, I've been writing some unit tests and have had some trouble with mail. I send mail using my application and then check these emails in my unit tests. All of this is handled by a local mail server (hMailServer). If I use CURL to request pages from my local server that send mail, the SMTP commands of the page all happen before the POP commands of my unit tests, so the mail is sent, then checked. If I load my bootstrap in my unit test the SMTP and POP commands are mixed up, so that not all SMTP commands are finished before POP commands are sent. This means the account can be checked before the mail has been sent, even though in the code the sending commands are before the checking commands. This happens whether I use PHP's mail() or Zend_Mail. It appears as though the local server waits for the SMTP commands to finish before it returns a result to CURL, whereas directly accessing my bootstrap allows the SMTP commands to run in the background almost as a separate thread. Any ideas on why this is happening? How can I force the SMTP commands to finish before code execution continues? Cheers, Steven -- Simon Mundy | Director | PEPTOLAB """ " "" """""" "" "" """"""" " "" """"" " """"" " """""" "" " 202/258 Flinders Lane | Melbourne | Victoria | Australia | 3000 Voice +61 (0) 3 9654 4324 | Mobile 0438 046 061 | Fax +61 (0) 3 9654 4124 http://www.peptolab.com -- Simon Mundy | Director | PEPTOLAB """ " "" """""" "" "" """"""" " "" """"" " """"" " """""" "" " 202/258 Flinders Lane | Melbourne | Victoria | Australia | 3000 Voice +61 (0) 3 9654 4324 | Mobile 0438 046 061 | Fax +61 (0) 3 9654 4124 http://www.peptolab.com
RE: [fw-general] Zend_Mail SMTP Threading?
I have tried both, with the same result -Original Message- From: Simon Mundy [mailto:[EMAIL PROTECTED] Sent: Wednesday, 12 March 2008 11:07 AM To: Steven Brown Cc: 'Bill Karwin'; fw-general@lists.zend.com Subject: Re: [fw-general] Zend_Mail SMTP Threading? Hi Steve - are you using the regular 'mail' transport or the SMTP transport when using Zend_Mail? > Hi all, > > I've been writing some unit tests and have had some trouble with mail. > > I send mail using my application and then check these emails in my > unit > tests. All of this is handled by a local mail server (hMailServer). > > If I use CURL to request pages from my local server that send mail, > the SMTP > commands of the page all happen before the POP commands of my unit > tests, so > the mail is sent, then checked. > > If I load my bootstrap in my unit test the SMTP and POP commands are > mixed > up, so that not all SMTP commands are finished before POP commands > are sent. > This means the account can be checked before the mail has been sent, > even > though in the code the sending commands are before the checking > commands. > > This happens whether I use PHP's mail() or Zend_Mail. > > It appears as though the local server waits for the SMTP commands to > finish > before it returns a result to CURL, whereas directly accessing my > bootstrap > allows the SMTP commands to run in the background almost as a separate > thread. > > Any ideas on why this is happening? How can I force the SMTP > commands to > finish before code execution continues? > > Cheers, > Steven > > -- Simon Mundy | Director | PEPTOLAB """ " "" """""" "" "" """"""" " "" """"" " """"" " """""" "" " 202/258 Flinders Lane | Melbourne | Victoria | Australia | 3000 Voice +61 (0) 3 9654 4324 | Mobile 0438 046 061 | Fax +61 (0) 3 9654 4124 http://www.peptolab.com
Re: [fw-general] Zend_Mail SMTP Threading?
Hi Steve - are you using the regular 'mail' transport or the SMTP transport when using Zend_Mail? Hi all, I've been writing some unit tests and have had some trouble with mail. I send mail using my application and then check these emails in my unit tests. All of this is handled by a local mail server (hMailServer). If I use CURL to request pages from my local server that send mail, the SMTP commands of the page all happen before the POP commands of my unit tests, so the mail is sent, then checked. If I load my bootstrap in my unit test the SMTP and POP commands are mixed up, so that not all SMTP commands are finished before POP commands are sent. This means the account can be checked before the mail has been sent, even though in the code the sending commands are before the checking commands. This happens whether I use PHP's mail() or Zend_Mail. It appears as though the local server waits for the SMTP commands to finish before it returns a result to CURL, whereas directly accessing my bootstrap allows the SMTP commands to run in the background almost as a separate thread. Any ideas on why this is happening? How can I force the SMTP commands to finish before code execution continues? Cheers, Steven -- Simon Mundy | Director | PEPTOLAB """ " "" "" "" "" """ " "" " " " " "" "" " 202/258 Flinders Lane | Melbourne | Victoria | Australia | 3000 Voice +61 (0) 3 9654 4324 | Mobile 0438 046 061 | Fax +61 (0) 3 9654 4124 http://www.peptolab.com
[fw-general] Zend_Mail SMTP Threading?
Hi all, I've been writing some unit tests and have had some trouble with mail. I send mail using my application and then check these emails in my unit tests. All of this is handled by a local mail server (hMailServer). If I use CURL to request pages from my local server that send mail, the SMTP commands of the page all happen before the POP commands of my unit tests, so the mail is sent, then checked. If I load my bootstrap in my unit test the SMTP and POP commands are mixed up, so that not all SMTP commands are finished before POP commands are sent. This means the account can be checked before the mail has been sent, even though in the code the sending commands are before the checking commands. This happens whether I use PHP's mail() or Zend_Mail. It appears as though the local server waits for the SMTP commands to finish before it returns a result to CURL, whereas directly accessing my bootstrap allows the SMTP commands to run in the background almost as a separate thread. Any ideas on why this is happening? How can I force the SMTP commands to finish before code execution continues? Cheers, Steven