Php 为什么我不能用siwapp发票软件发送电子邮件?
我已经安装了siwapp发票软件。它已成功安装,但当我尝试使用定期配置文件,甚至向我的客户发送发票时,出现了一个错误,显示:Php 为什么我不能用siwapp发票软件发送电子邮件?,php,fsockopen,mailer,Php,Fsockopen,Mailer,我已经安装了siwapp发票软件。它已成功安装,但当我尝试使用定期配置文件,甚至向我的客户发送发票时,出现了一个错误,显示: Warning: fsockopen() [function.fsockopen]: unable to connect to localhost:25 (Connection refused) in /home/olepress/public_html/my/lib/vendor/symfony/lib/vendor/swiftmailer/classes/Swift/
Warning: fsockopen() [function.fsockopen]: unable to connect to localhost:25 (Connection refused) in /home/olepress/public_html/my/lib/vendor/symfony/lib/vendor/swiftmailer/classes/Swift/Transport/StreamBuffer.php on line 233
Warning: Cannot modify header information - headers already sent by (output started at /home/olepress/public_html/my/lib/vendor/symfony/lib/vendor/swiftmailer/classes/Swift/Transport/StreamBuffer.php:233) in /home/olepress/public_html/my/lib/vendor/symfony/lib/response/sfWebResponse.class.php on line 336
Warning: Cannot modify header information - headers already sent by (output started at /home/olepress/public_html/my/lib/vendor/symfony/lib/vendor/swiftmailer/classes/Swift/Transport/StreamBuffer.php:233) in /home/olepress/public_html/my/lib/vendor/symfony/lib/response/sfWebResponse.class.php on line 357
Warning: Cannot modify header information - headers already sent by (output started at /home/olepress/public_html/my/lib/vendor/symfony/lib/vendor/swiftmailer/classes/Swift/Transport/StreamBuffer.php:233) in /home/olepress/public_html/my/lib/vendor/symfony/lib/response/sfWebResponse.class.php on line 357
我试图搜索它,有很多问题与我的问题相似,但我不太确定我们是否使用相同的软件。尝试在该软件的源文件周围播放,我发现该配置文件包含:
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
all:
routing:
class: sfPatternRouting
param:
generate_shortest_url: true
extra_parameters_as_query_string: true
user:
class: SiwappUser
param:
timeout: 1800
logging: %SF_LOGGING_ENABLED%
use_flash: true
default_culture: %SF_DEFAULT_CULTURE%
#all:
# controller:
# class: sfFrontWebController
#
# request:
# class: sfWebRequest
# param:
# logging: %SF_LOGGING_ENABLED%
# path_info_array: SERVER
# path_info_key: PATH_INFO
# relative_url_root: ~
# formats:
# txt: text/plain
# js: [application/javascript, application/x-javascript, text/javascript]
# css: text/css
# json: [application/json, application/x-json]
# xml: [text/xml, application/xml, application/x-xml]
# rdf: application/rdf+xml
# atom: application/atom+xml
#
# response:
# class: sfWebResponse
# param:
# logging: %SF_LOGGING_ENABLED%
# charset: %SF_CHARSET%
# send_http_headers: true
#
# user:
# class: myUser
# param:
# timeout: 1800
# logging: %SF_LOGGING_ENABLED%
# use_flash: true
# default_culture: %SF_DEFAULT_CULTURE%
#
# storage:
# class: sfSessionStorage
# param:
# session_name: symfony
#
# view_cache:
# class: sfFileCache
# param:
# automatic_cleaning_factor: 0
# cache_dir: %SF_TEMPLATE_CACHE_DIR%
# lifetime: 86400
# prefix: %SF_APP_DIR%/template
#
# i18n:
# class: sfI18N
# param:
# source: XLIFF
# debug: false
# untranslated_prefix: "[T]"
# untranslated_suffix: "[/T]"
# cache:
# class: sfFileCache
# param:
# automatic_cleaning_factor: 0
# cache_dir: %SF_I18N_CACHE_DIR%
# lifetime: 31556926
# prefix: %SF_APP_DIR%/i18n
#
# routing:
# class: sfPatternRouting
# param:
# load_configuration: true
# suffix: ''
# default_module: default
# default_action: index
# debug: %SF_DEBUG%
# logging: %SF_LOGGING_ENABLED%
# generate_shortest_url: false
# extra_parameters_as_query_string: false
# cache:
# class: sfFileCache
# param:
# automatic_cleaning_factor: 0
# cache_dir: %SF_CONFIG_CACHE_DIR%/routing
# lifetime: 31556926
# prefix: %SF_APP_DIR%/routing
#
# logger:
# class: sfAggregateLogger
# param:
# level: debug
# loggers:
# sf_web_debug:
# class: sfWebDebugLogger
# param:
# level: debug
# condition: %SF_WEB_DEBUG%
# xdebug_logging: true
# web_debug_class: sfWebDebug
# sf_file_debug:
# class: sfFileLogger
# param:
# level: debug
# file: %SF_LOG_DIR%/%SF_APP%_%SF_ENVIRONMENT%.log
我错过什么了吗?如何解决此问题?检查该应用程序的配置:您必须配置要使用的邮件服务器(smtp服务器)。在使用其他软件时,为它提供发送邮件的服务器的地址 如果您在linux上,请尝试在服务器上安装sendmail,(debian/ubuntu
sudo-apt-get-install-sendmail
,(rhat/centosyum-install-sendmail
)
如果您有外部SMTP服务器(如Gmail)或ISP的凭据,您应该能够在找到的配置文件中指定主机详细信息和凭据,请参阅文档以了解详细信息
您可以将SMTP与以下类似的配置一起使用:
prod:
...
mailer:
param:
delivery_strategy: realtime
transport:
param:
host: smtp.gmail.com
port: 465
encryption: ssl
username: your_gmail_username@gmail.com
password: your_gmail_password
要使用PHP sendmail,请使用如下配置:
prod:
...
mailer:
param:
delivery_strategy: realtime
transport:
class: Swift_MailTransport
要编辑的配置文件是siwapp/config/factories.yml
希望能有所帮助。我知道这个线程很旧,但我终于找到了解决这个非常严重错误的方法 siwapp的安装说明有点…有点零碎,很难获得完整的图片。我同时编译了这些说明 将factories.yml文件复制到配置文件夹中
cp/apps/siwapp/config/factories.yml/config/factories.yml
这样修改prod部分
prod:
...
mailer:
param:
delivery_strategy: realtime
transport:
param:
host: smtp.gmail.com
port: 465
encryption: ssl
username: your_email_address@gmail.com
password: your_password
替换地址和密码的值
清空/cache/*(但不要删除目录本身!)处的缓存以删除旧的配置。不过,我以前在这方面遇到过问题,因此建议您备份缓存目录
tar-czf siwappcachebkp.tgz/cache/*
要在重建缓存因某种原因失败时手动配置电子邮件,您需要专门修改此文件:
/cache/siwapp/prod/config/config\u factories.yml.php
在文件末尾,您将找到硬编码为映射的邮件连接详细信息;输入正确的值,您就可以开始了。
无法连接到本地主机:25(连接被拒绝)
表示您没有在本地主机上运行邮件服务器,或者它没有在端口25上侦听(可能是465或587)。您知道如何发送邮件(sendmail、本地smtp服务器或远程服务器)?很抱歉,我是这个问题的新手,我不了解这个过程。我已经将配置更改为正确的登录信息、主机和端口,但问题仍然存在。如果您指定了另一个smtp服务器,并且它仍然尝试连接到localhost:25,那么您知道在哪里查找:您的配置似乎被忽略。没有如果您提供了您参考的配置,这里恐怕没有人可以对此发表评论。我使用的是共享主机,是否仍然可以解决此问题?如果您使用共享主机,那么您应该能够发送邮件。请查看编辑后的答案,然后试着改用sendmail。如果您愿意,您仍然可以使用SMTP。我有siwapp/config/factories.y上面的ml配置,我不太确定把你编辑的代码放在哪里。请在你发布的mailer
部分的开头写着delivery\u strategy:none
,所以你可以用上面的配置之一替换该部分,可能先试试实时Swift\u-MailTransport。