Ignore:
Timestamp:
Aug 22, 2010, 5:12:13 PM (11 years ago)
Author:
popeye
Message:

modifications du mailer suite à son inclusion dans la 1.4

File:
1 edited

Legend:

Unmodified
Added
Removed
  • cpc/trunk/project/apps/frontend/modules/mail/actions/components.class.php

    r1078 r1266  
    11<?php
    2 
    3 require_once sfConfig::get('sf_lib_dir').'/vendor/swift/swift_init.php';
    4 
    52class mailComponents extends sfComponents
    63{
    74  public function executeSend()
    85  {
    9 
    106    if (!isset($this->subject))
    117      throw new Exception('subject needed');
     
    2117
    2218    if (isset($this->action))
    23       throw new Exception('action should not be defenied anymore');
     19      throw new Exception('action should not be defined anymore');
    2420
    2521    $this->getContext()->getConfiguration()->loadHelpers('Partial');
    2622   
    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);
    4929  }
    5030}
     31
     32?>
Note: See TracChangeset for help on using the changeset viewer.