This plugin is deprecated and is not maintained anymore.
sfZendMailPlugin
0.0.7beta
for sf 1.2 MIT
sfZendMailPlugin
Plugin based on swToolboxPlugin mail feature by Thomas Rabaix. The primary changes from his implementation are seperating the mail feature from swToolbox.
This solution is based on Zend_Mail for more information please refer to the Zend Framework documentation
available at : http://framework.zend.com/manual/en/zend.mail.html
Developers
License
Copyright (c) 2008 Thomas Rabaix
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is furnished
to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
Releases for sf 1.2
| Version |
License |
API |
Released |
|
0.0.7beta
|
MIT license |
0.0.7beta
|
29/06/2009 |
Changelog for release 0.0.7 - 29/06/2009
Other releases
Release 0.0.7 - 29/06/2009
sfZendMailPlugin
Plugin based on swToolboxPlugin mail feature by Thomas Rabaix. The primary changes from his implementation are seperating the mail feature from swToolbox.
The built in mail feature was removed from sf1.1 and sf1.2. This will simulate the sendEmail method from sf1.0
and add extras features :
- email decorator
- Zend_Mail Support
- Charset and Encoding
- variables assignement from the controller
This solution is based on Zend_Mail for more information please refer to the Zend Framework documentation
available here
Install Zend Framework via pear or manually
Installation
Install the plugin
symfony plugin:install sfZendMailPlugin
Install Zend Framework manually from Zend's Website or via pear
pear channel-discover pear.zfcampus.org
pear install zfcampus/zf
Edit the app.yml file
all:
sf_zend_mail:
#framework_location: /usr/local/zend/share/ZendFramework/library/Zend
config:
charset: utf-8 # charset to use : utf-8, iso-8859-1, ...
encoding: quoted-printable # 7bit, 8bit, quoted-printable, base64 (default : quoted-printable)
#transport: # define which transport class to used, one or the other not both
# sample with Sendmail
#class: Zend_Mail_Transport_Sendmail # Zend_Mail_Transport_Sendmail | Zend_Mail_Transport_Smtp
#parameters: "-ffrom@yourdomain.com"
# sample with Smtp
#class: Zend_Mail_Transport_Smtp # Zend_Mail_Transport_Sendmail | Zend_Mail_Transport_Smtp
#parameters:
# - 127.0.0.1 # URL or IP of the smtp server
# - { auth: Plain|Crammd5|Login, username: yourusername, password: yourpassword } #if required, else don't set
decorator: # define the layout use in the mail
enabled: off # on | off : set true if all your mail share the same layout
directory: "%SF_APP_TEMPLATE_DIR%" # where the layout is located, ie %SF_APP_TEMPLATE_DIR%
template: email # name of the layout, automatically translate to name.FORMAT.php
view: # define the view class used to render the template
class: sfZendMailView
Clear your cache
Usage
public function executeConfirmPayment()
{
// [...]
// create object in your controller
$invoice = Doctrine::getTable('Invoice')->find(..);
// call the email action
$this->sendEmail('yourModule', 'sendInvoice', array('invoice' => $invoice);
}
public function executeSendInvoice(sfWebRequest $request)
{
$mail = new sfZendMail;
$mail->setSubject('Your Invoice #'.$invoice->getReference());
$mail->setFrom('billing@yoursite.com', 'Billing Service');
$mail->addTo($this->invoice->getEmail(), $this->invoice->getName());
$this->mail = $mail;
}
You should have a least one template file : sendInvoiceSuccess.txt.php or sendInvoiceSuccess.html.php in your
module/templates folder.
If you want a specific layout around your email (like default header and footer), enable the decorator option
and create a 'email.txt.php' and/or 'email.html.php' inside the decorator directory.