A ZF project would not run out of the box on a fresh installation of WAMP. The purpose of this guide is to act as a checklist for the experienced, and a step by step guide for the more inexperienced. Before we start, this article is written based on WampServer 2.0i with Zend Framework 1.10. If you are using earlier versions, the steps should work, but you might want to consider upgrading to the newest.
- Make sure Wamp is running ok
- Enable virtual hosts, mod_rewrite, and override in ‘httpd.conf’
- Set up virtual host in ‘httpd-vhosts.conf’
- Check include paths for the Zend library
- Add Custom URLs in host file
1. Make sure Wamp is running ok
Navigate to http://localhost on your favorite browser, you should see the WampServer welcome screen with headings “Server Configuration”, “Tools”, “Your projects” etc. If not, check your Wamp installation before proceeding further.
To send emails using gmail’s smtp server, you must specify the tls port by providing the ‘ssl’ and ‘port’ in the config array. The default port for tls is 25 but gmail is using 587. You will also need to authenticate with your account and password.
Update: There’s a daily limit of outgoing emails you can send using this smtp, I experienced a problem of maxing my limit while sending out confirmation emails to the users of my facebook app. So if you are looking to do the same, just be warned that its a bad idea.
$config = array(
‘ssl’ => ‘tls’,
‘port’ => 587,
‘auth’ => ‘login’,
‘username’ => ‘firstname.lastname@example.org’,
‘password’ => ‘password’);
$transport = new Zend_Mail_Transport_Smtp(‘smtp.gmail.com’, $config);
//Use this if you do not want to specify $transport evertime you use Zend_Mail->send()
$mail = new Zend_Mail();
$mail->setBodyText(‘Email body in plain text’);
$mail->setBodyHtml(‘Email body in HTML’);
$mail->setFrom(‘email@example.com’, ‘Name of sender’);
$mail->setReplyTo(‘firstname.lastname@example.org’,’Name of sender’);
$mail->addTo(‘email@example.com’, ‘Name of recipient’ );
$mail->setSubject(‘Your trial at FItness First’);
You can use your own domain name using gmail’s coporate email service, if not, just use gmail.com for the domain.
Catch, gmail automatically replaces whatever ‘from’ or ‘reply-to’ you have specified with the account you are authenticating with (firstname.lastname@example.org). To use another account, you must allow gmail to send using that email address by following the steps here.