簡體   English   中英

Symfony 3 FOSUserBundle不發送郵件

[英]Symfony 3 FOSUserBundle doesn't send mail

我最近對FOSUserBundle有一個小問題。 從上周開始,當我的Swift Mailer配置正常運行時,它不再發送任何電子郵件。 我可以通過聯系表格發送郵件。 我所做的唯一修改是在parameters.yml文件中添加了一些字段。

這是我的config.yml

# Swiftmailer Configuration
swiftmailer:
  default_mailer: mailer_1
  mailers:
    mailer_1:
      transport: '%mailer_transport%'
      encryption: '%mailer_encryption%'
      auth_mode:  '%mailer_auth_mode%'
      host: '%mailer_host%'
      username: '%mailer_user%'
      password: '%mailer_password%'
      port: '%mailer_port%'
      sender_address: '%mailer_name%'
      spool:
           type: file
           path: '%kernel.project_dir%/spool'

fos_user:
    db_driver: orm
    firewall_name: main
    user_class: AppBundle\Entity\User
    service:
            mailer: fos_user.mailer.twig_swift
    from_email:
      address: '%mailer_user%'
      sender_name: '%mailer_name%'
    registration:
        confirmation:
            enabled: true
            template:   '@FOSUser/Registration/email.txt.twig'
        form:
            type: AppBundle\Form\RegistrationFormType
    resetting:
            email:
                template:   '@FOSUser/Resetting/email.txt.twig'
    profile:
        form:
          type: AppBundle\Form\ProfileFormType

我知道,在郵件fos_user必須是在同一個swiftmailer ,並在這里。 任何想法?

查看您的parameters.yml文件,您可能尚未配置smtp信息的正確性。 如果要使用php的mail()函數,則必須根據服務器的配置來配置php.ini

希望能幫助到你。

嘗試像這樣配置您的parameters.yml:

parameters:
    mailer_transport: mail
    mailer_host: smtp.gmail.com
    mailer_user:
    mailer_password:

它為我工作(Symfony 3.4),但根據接收方的不同,它可能會到達SPAM。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM