Zend_Mail and Form Elements

Setting up for Lesson 8

Download the lesson 8 folder.

Update start/scripts/library.php with your own database information.

Copy start/scripts/library.php to overwrite completed/scripts/library.php

PHP email

Sending email with the basic PHP core libraries is a snap, just call
mail($to, $subject, $headers, $parameters);

This may be fine for an autoresponder contact form acknowledgement, but Zend_Mail has much more functionality: simplifying attachments, iterative email dispatching, styling HTML mail and protecting from hacker attacks.


Use sendmail transport

Do not use recapcha – requires domain specific key

Form Elements

12 comments for “Zend_Mail and Form Elements

  1. April 18, 2011 at 12:46 pm

    For some reason, the “send comments” submit button doesn’t show up. Again, can you take a look and clue me in, please.

  2. Tomas
    April 18, 2011 at 4:10 pm

    Hi Linda – try adding the send comment button –

  3. April 18, 2011 at 9:05 pm

    Very weird. I looked at “View Source” and the code for the
    ‘send comment” button is not there. However, it is in the code of the page that I made. Strange indeed.

  4. Mark Alarie
    April 20, 2011 at 11:04 pm

    I seem to have hit a roadblock. I have typed in all the code in lesson 8
    (leaving out the recaptcha part)

    My comments.php form displays much of the code from process_comments.php at the top in LiveView. This code shouldn’t be visible.
    I have no idea why–any suggestions? (also it is only a blank screen in the browser)
    I checked the same file in the completed folder and it also does the same thing.

    I don’t know how to better illustrate the problem. Hope it makes sense to someone.

  5. April 21, 2011 at 2:33 am

    Mark – Your library.php file needed to be updated with the correct path for the Zend libraries and Autoloader. I logged into your server and updated those two lines and the comment form seems to work now.

  6. Mark Alarie
    April 21, 2011 at 6:42 am

    thanks Jay
    I wasn’t looking there.
    still having some issues:
    When I enter the info and click Send comments button, the form tries to do something and eventually puts “connection timed out” at the top of the page and I haven’t received email yet.

  7. Annette Kirchner
    April 21, 2011 at 11:35 am

    Hi Mark,

    I had the same problem except that it didn’t give me the connection time out message. You could check to make sure the email addresses are different – see page 273 Caution. I went through and made sure the email addresses matched where they were supposed to and were different where needed and finally it worked. Mail received.

    Now, back to Ch 7!

    • April 21, 2011 at 8:28 pm

      I think it’s easiest to stick with the sendmail protocol not the SMTP protocol, as explained on page 261

  8. Mark Alarie
    April 22, 2011 at 6:41 am

    Yes, once I replaced the SMTP code with the sendmail code, I was able to receive an email with the form data.

  9. Annette Kirchner
    April 25, 2011 at 6:27 pm

    And I found my problem. Same as before – I had one of my email addresses written incorrectly on the mail connector page. Once I changed the edu to com the sendmail code worked. Something about having a clear brain helps, too.

  10. June 12, 2011 at 6:03 pm

    A request for help. What do you mean by replacing the Zend smtp code with sendmail code. I have the same connection time out problem like Mark Alarie. Here is my code for the mailconnector:

    ‘username’ => ‘info@kdawgtv.com’,
    ‘password’ => ‘xxxxxx’);
    $transport = new Zend_Mail_Transport_Smtp($mailhost, $mailconfig);

    Where would I make the change with sendmail???? Any help is greatly appreciated. Thank you.

Comments are closed.