Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Multi Stage with Zend Framework - where to configure/store form emails?
- $this->request->setMethod('POST')
- ->setPost(array(
- 'name'
- => 'Some Name',
- 'email'
- => 'contact@email.com',
- 'message'
- => "This is my test message."
- ));
- $this->dispatch('/about/contact');
- [production]
- contact.email.address = "trueemail@email.com"
- contact.email.name = "John Stuart"
- joinus.email.address = "anotheremail@email.com"
- joinus.email.name = "Patricia Bill"
- [development : production]
- contact.email.address = "my@email.com"
- contact.email.name = "Devname"
- joinus.email.address = "my@email.com"
- joinus.email.name = "Devname"
- if (APPLICATION_ENV == 'development') {
- $email = 'yourtestemail@example.com'; // your test email address
- } else {
- $email = 'normalemail@example.com'; // whatever the email should be
- }
- class Yourapp_Form extends Zend_Form
- {
- protected $_recipientEmail;
- public function setRecipientEmail($email)
- {
- $this->_recipientEmail = $email;
- }
- public function getRecipientEmail()
- {
- if (APPLICATION_ENV == 'develpoment') {
- return 'yourtestemail@example.com';
- } else {
- return $this->_recipientEmail;
- }
- }
- }
- class Yourapp_Contact_Form extends Yourapp_Form
- {
- public function init()
- {
- $this->addElement([...]);
- $this->setRecipientEmail('foo@example.com'); // <-- production email address
- }
- }
- [development]
- resources.log.stream.filterName = "Priority"
- resources.log.stream.filterParams.priority = Zend_Log::DEBUG
- [production]
- resources.log.stream.filterName = "Priority"
- resources.log.stream.filterParams.priority = Zend_Log::DEBUG
- [production]
- app.contacts.service1.name = "Paul Dupont"
- app.contacts.service1.email = "paul.dupont@example.com"
- app.contacts.service1.company = "Another Best Company"
- app.contacts.service1.name = "Kristina Dupuis"
- app.contacts.service1.email = "k.dupuis@example.com"
- [development]
- app.contacts.service1.name = "Me"
- app.contacts.service1.email = "me@example.com"
- app.contacts.service1.company = "THE best company"
- app.contacts.service1.name = "Myself"
- app.contacts.service1.email = "myself@example.com"
- interface Service // Service means here the competent service of your company
- {
- public function getEmail() {}
- public function getContactName() {}
- public function getCompanyName() {}
- }
- // usage, somewhere in your code :
- $this->request->setMethod('POST')
- ->setPost(array(
- 'name' => $serviceService->getService('contactus')->getContactName(),
- 'email' => $serviceService->getService('contactus')->getEmail(),
- 'message' => "This is my test message."
- ));
- $this->dispatch('/about/contact');
Add Comment
Please, Sign In to add comment