Configuration 无效的YAML阻止我发送电子邮件?

Configuration 无效的YAML阻止我发送电子邮件?,configuration,yaml,symfony4,Configuration,Yaml,Symfony4,所以我正在使用symfonyapi,我试图通过SwiftMailer发送电子邮件,我将其设置为正确的代码,我也试图设置配置文件,但我想我遇到了一个错误 这是我的swiftmailer.yaml配置文件: swiftmailer: transport: gmail host: localhost port: 465 encryption: ssl auth-mode: login

所以我正在使用symfonyapi,我试图通过SwiftMailer发送电子邮件,我将其设置为正确的代码,我也试图设置配置文件,但我想我遇到了一个错误

这是我的swiftmailer.yaml配置文件:

swiftmailer:
    transport:       gmail
    host:            localhost
    port:            465
    encryption:      ssl
    auth-mode:       login 
    username:        "****@gmail.com"
    password:        "*******"
    spool: 
        { type: "memory" }
    stream_options:
    ssl:
      allow_self_signed: true
      verify_peer: false
      verify_peer_name: false
但是,当我尝试执行代码时,会出现以下错误:

档案 “C:\Users\Dell\Desktop\Learn\symfprojs\correctsymf\config/packages/swiftmailer.yaml” 不包含有效的YAML:引用“***@gmail.com”不包含 存在于中的第6行(靠近“用户名:***@gmail.com”) C:\Users\Dell\Desktop\Learn\symfprojs\correctsymf\config/packages/swiftmailer.yaml (已加载到资源中) “C:\Users\Dell\Desktop\Learn\symfprojs\correctsymf\config/packages/swiftmailer.yaml”)


任何帮助都将不胜感激。

您正在文件的顶层定义配置,但它应该在
mailers.%mailer\u name%
项下。假设您的应用程序只有一个邮件程序:

swiftmailer:
    default_mailer: default
    mailers:
        default:
            transport: gmail
            # ...