ZF-11759: With netbeans as IDE. when trying to use zend mail with the following code inside Application/views/scripts/index/index.php, i couldn't send mail, instead sometimes i get a blank white screen after running or else get "An error occurred. Application

Description

i am new to zend framework. i am using netbeans as IDE. when trying to use zend mail with the following code inside Application/views/scripts/index/index.php, i couldn't send mail, instead sometimes i get a blank white screen after running or else get "An error occurred. Application error. can any one help me in running the following code

<?php require_once 'Zend/Mail.php'; require_once 'Zend/Mail/Transport/Smtp.php'; $smtpServer = 'smtp.gmail.com'; $username = 'me@gmail.com'; $password = 'mypassword'; $config = array('ssl' => 'tls', 'port' => 465, 'auth' => 'login', 'username' => $username, 'password' => $password); $transport = new Zend_Mail_Transport_Smtp($smtpServer, $config); Zend_Mail::setDefaultTransport($transport); $mail = new Zend_Mail(); $mail->setFrom('me@gmail.com', 'Some Sender'); $mail->addTo('myfriend@gmail.com', 'Some Recipient'); $mail->setSubject('Test Subject'); $mail->setBodyText('This is the text of the mail.'); $mail->send($transport); ?>
Zend Mail has been sent successfully.

Comments

I'm closing this as not an issue as it appears to be a support request rather than an issue with any Zend Framework functionality.

Your view file appears to have the wrong suffix (usually it would be .phtml) check this, and ensure your error_reporting is set to a level which will give you useful output in either your error logs, or browser.

Please also check that you are following the suggested application structure. If you are new to Zend Framework, you may wish to check out Akrabats tutorial http://akrabat.com/zft

Ryan, Thanks very much for your reply. sorry, i just made a mistake in typing. it is not index.php. In fact i used above code in the right extension 'index.phtml'(Application/Views/Scripts/index/index.phtml) only. As i am the beginner of zend php, i think i have to go through error_reporting. in the mean time you can fix my problem i welcome. Thanks again.