Send mail through smtp.gmail.com in symfony 2 using swiftmailer

廉价感情. 提交于 2019-12-05 11:35:37

u can try this one

Parameter.yml

mailer_transport: gmail
mailer_encryption: ssl
mailer_auth_mode: login
mailer_host: smtp.gmail.com
mailer_user: 'xxxxxxxxxxxx'

config.yml

swiftmailer:
   transport: gmail
   host:      smtp.gmail.com
   username:  'Yourmail@gmail.com'
   password:  'Password'

You can either specify the parameters directly in the Swift mailer cofiguration or read them from parameters.ini.

Example:

In parameters.ini

mailer_transport  = smtp
mailer_host       = localhost
mailer_user       = null    
mailer_password   = null

In config.yml,

# Swiftmailer Configuration
swiftmailer:
    transport: smtp
    encryption: ssl
    auth_mode: login
    host:      smtp.gmail.com
    username:  user@xyz.com
    password:  password
    spool:
      type: file
      path: "%kernel.root_dir%/extras/spool"

Here, 'path' is the path to the directory where the spooled mails are stored.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!