我是一个Symfony菜鸟,但我坚持我确定应该工作的东西。我在localhost上使用“dev”环境,并且我正在尝试测试向用户发送电子邮件的操作。我将“dev”的delivery_strategy设置为none,但Symfony仍尝试使用“all”的设置。这是我的个工厂。:
prod:
logger:
class: sfNoLogger
param:
level: err
loggers: ~
test:
storage:
class: sfSessionTestStorage
param:
session_path: %SF_TEST_CACHE_DIR%/sessions
response:
class: sfWebResponse
param:
send_http_headers: false
mailer:
param:
delivery_strategy: none
dev:
mailer:
param:
delivery_strategy: none
all:
routing:
class: sfPatternRouting
param:
generate_shortest_url: true
extra_parameters_as_query_string: true
view_cache_manager:
class: sfViewCacheManager
param:
cache_key_use_vary_headers: true
cache_key_use_host_name: true
mailer:
class: sfMailer
param:
logging: %SF_LOGGING_ENABLED%
charset: %SF_CHARSET%
delivery_strategy: realtime
transport:
class: Swift_SmtpTransport
param:
host: localhost
port: 25
encryption: ~
username: ~
password: ~
我得到的错误:
Connection could not be established with host localhost [A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond.
10060]
我已经检查过只有在factories.yml文件上(对于应用程序“frontend”级别)。
谢谢! 标记
答案 0 :(得分:1)
这是我的配置:
prod:
test:
mailer:
param:
delivery_strategy: none
dev:
mailer:
param:
delivery_strategy: none
all:
mailer:
class: sfMailer
param:
logging: %SF_LOGGING_ENABLED%
charset: %SF_CHARSET%
delivery_strategy: realtime
transport:
class: Swift_SmtpTransport
param:
host: itb1
port: 25
encryption: ~
username: ~
password: ~
希望这有帮助。
答案 1 :(得分:1)
尝试指定类,这对我有用:
dev:
mailer:
param:
delivery_strategy: none
transport:
class: Swift_NullTransport