I use Symfony 1.4 and I have two different configurations for the prod and dev environment, the former use the single_address as delivery strategy, and the latter use the spool:
dev:
mailer:
class: sfMailer
param:
delivery_strategy: single_address
delivery_address: my@email
transport:
class: Swift_SmtpTransport
[...]
prod:
mailer:
class: sfMailer
param:
delivery_strategy: spool
spool_class: Swift_PropelSpool
spool_arguments: [ MailMessage, message, getSpooledMessages ]
transport:
class: Swift_SmtpTransport
I was wondering if Symfony could add automatically, in the dev environment, some text to the mail subject (i.e. [DEVELOPMENT EMAIL - PLEASE DISCARD]).
Thanks a lot
From the part where you are sending the e-mail you can use the sfConfig::get('sf_environment')
variable to set your subject.
<?php
$subject = 'Some Subject';
if (sfConfig::get('sf_environment') == 'dev')
{
$subject = '[DEVELOPMENT EMAIL - PLEASE DISCARD] ' . $subject;
}
To do this globally you can use a base Mailer class as described in http://www.symfony-project.org/gentle-introduction/1_4/en/11-Emails#chapter_11_email_messages_as_classes