<?php

class wpMail extends Swift {
    public function __construct($domain = false, $options = null) {
        parent::__construct(new Swift_Connection_SMTP(sfConfig::get('app_mail_smtp'), sfConfig::get('app_mail_port', 25)), $domain, $options);
    }

    public function send(Swift_Message $message, $recipients, $from) {
        if ('' != $debug_email = wpConfig::getDebugEmail()) {
            if ($recipients instanceof Swift_Address) {
                $message->setBody("\n[Destinataire original : " . sprintf('%s <%s>', $recipients->getName(), $recipients->getAddress()) . "]\n\n" . $message->getBody());
            }
            $recipients = new Swift_Address($debug_email);
        }
        return parent::send($message, $recipients, $from);
    }
}