Changeset 1266
- Timestamp:
- Aug 22, 2010, 5:12:13 PM (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
cpc/trunk/project/apps/frontend/modules/mail/actions/components.class.php
r1078 r1266 1 1 <?php 2 3 require_once sfConfig::get('sf_lib_dir').'/vendor/swift/swift_init.php';4 5 2 class mailComponents extends sfComponents 6 3 { 7 4 public function executeSend() 8 5 { 9 10 6 if (!isset($this->subject)) 11 7 throw new Exception('subject needed'); … … 21 17 22 18 if (isset($this->action)) 23 throw new Exception('action should not be def enied anymore');19 throw new Exception('action should not be defined anymore'); 24 20 25 21 $this->getContext()->getConfiguration()->loadHelpers('Partial'); 26 22 27 $message = Swift_Message::newInstance() 28 29 //Give the message a subject 30 ->setSubject($this->subject) 31 32 //Set the From address with an associative array 33 ->setFrom(array('contact@nosdeputes.fr' => '"Nos Deputes (Ne pas repondre)"')) 34 35 //Set the To addresses with an associative array 36 ->setTo($this->to) 37 38 //Give it a body 39 ->setBody(get_partial('mail/'.$this->partial, $this->mailContext)) 40 ; 41 42 43 $transport = Swift_SmtpTransport::newInstance(); 44 45 $mailer = Swift_Mailer::newInstance($transport); 46 47 $result = $mailer->send($message); 48 23 $message = $this->getMailer()->compose(array('contact@nosdeputes.fr' => '"Nos Deputes (Ne pas repondre)"'), 24 $this->to, 25 $this->subject, 26 get_partial('mail/'.$this->partial, $this->mailContext) 27 ); 28 $this->getMailer()->send($message); 49 29 } 50 30 } 31 32 ?>
Note: See TracChangeset
for help on using the changeset viewer.