Question

I am having a trouble of sending mail from xampp localhost using gmail. And after a long time I finally successful on it. And I am sharing it with all you. If I am wrong need proper solution for it.

in config.yml of your symfony 2 Write those

swiftmailer:
    disable_delivery:  false
    transport: %mailer_transport%
    host:      %mailer_host%
    username:  %mailer_user%
    password:  %mailer_password%
    port:      %mailer_port%
    encryption: %mailer_encryption%

In your parameters.yml

mailer_transport: smtp
mailer_host: smtp.gmail.com
mailer_user: gmail_user_id_without_@gmail.com
mailer_password: Your_gmail_pass
mailer_port: 465 or 587
mailer_encryption:  ssl 
Was it helpful?

Solution

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'

OTHER TIPS

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.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top