smtp - swiftmailer configuration for more than one accounts in Symfony 2 -


i use gmail send mails ,so config ‘config.yml’ this

swiftmailer: transport: %mailer_transport% encryption: %mailer_encryption% auth_mode: %mailer_auth% host:      %mailer_host% username:  %mailer_user% password:  %mailer_password% 

‘parameters.yml’ this

mailer_transport:  smtp mailer_encryption: ssl mailer_auth:       login mailer_host:       smtp.gmail.com mailer_user:       lee@gmail.com mailer_password:   ****** 

now want use more mail accounts send mails different goals. eg:use lee@gmail.com send mails welcome;use lee1@gmail.com send mails reset password.

what should config swiftmailer?

if using swiftmailer 2.3.3 have possibility make simply:

in parameters.yml add:

mailer2_transport: smtp mailer2_encryption: ssl mailer2_auth_mode: login mailer2_host: smtp.gmail.com mailer2_user: your@gmail.com mailer2_password: ******* 

in config.yml make changes:

swiftmailer:     default_mailer: mailer     mailers:         mailer:             transport: %mailer_transport%             host:      %mailer_host%             username:  %mailer_user%             password:  %mailer_password%             encryption: %mailer_encryption%             auth_mode: %mailer_auth_mode%         mailer2:             transport: %mailer2_transport%             host:      %mailer2_host%             username:  %mailer2_user%             password:  %mailer2_password%             encryption: %mailer2_encryption%             auth_mode: %mailer2_auth_mode% 

in code if write:

$mailer = $this->get('swiftmailer.mailer.mailer2'); 

you settings section;

and if write:

$mailer = $this->get('swiftmailer.mailer.default'); 

or

$mailer = $this->get('mailer'); // default configuration 

you use settings default section;


Comments

Popular posts from this blog

linux - xterm copying to CLIPBOARD using copy-selection causes automatic updating of CLIPBOARD upon mouse selection -

c++ - qgraphicsview horizontal scrolling always has a vertical delta -