Welcome, guest! Login / Register - Why register?
Psst.. new poll here.
Psst.. new forums here.
Microsoft is blocking us again (TY IP Reputation!) so just use oauth login instead. :)

Paste

Pasted as PHP by registered user psylosss ( 17 years ago )
//app/frontend/modules/sfApply/actions/actions.class.php

  function mail($options)
  {
    $required = array('subject', 'parameters', 'email', 'fullname', 'html', 'text');
    foreach ($required as $option)
    {
      if (!isset($options[$option]))
      {
        throw new sfException("Required option $option not supplied to sfApply::mail");
      }
    }

    $from = $this->getFromAddress();

    $message=Swift_Message::newInstance()
      ->setFrom(array($from['email']=>$from['fullname']))
      ->setTo(array($options['email']=>$options['fullname']))
      ->setSubject($options['subject'])
      ;

    $message->attach($this->createContentAttachment($this->getPartial($options['html'], $options['parameters']), 'text/html'));
    $message->attach($this->createContentAttachment($this->getPartial($options['text'], $options['parameters']), 'text/plain'));

    $message->setEncoder(Swift_Encoding::get8BitEncoding());

    $this->getMailer()->send($message);
  }



  protected function createContentAttachment($content, $content_type='text/html')
  {
    $part = Swift_MimePart::newInstance($content, $content_type);
    $part->setEncoder(Swift_Encoding::get8BitEncoding());
    return $part;
  }

 

Revise this Paste

Your Name: Code Language: