我很抱歉提前发布了一个关于symfony4迅捷邮件的第N个问题,但是由于我从来无法用它发送电子邮件,我想我的问题可能是来自塞弗尼的其他地方。(注:最后,我需要与甘地合作,但我首先尝试的是GMAIL,因为更多的话题是相关的)。
博士:甘地SMTP公司
至少这里是我的配置(.env)
APP_ENV=prod (tried all with DEV too)
...
#MAILER_URL=gmail://****@gmail.com:****@localhost
#MAILER_URL=smtp://smtp.gmail.com:587?encryption=tls&username=****&password=****
#MAILER_URL=smtp://mail.gandi.net:25?encryption=tls&auth_mode=login&username=****&password=****
#MAILER_URL=smtp://mail.gandi.net:25?encryption=ssl&auth_mode=login&username=****&password=****
#MAILER_URL=smtp://mail.gandi.net:465?encryption=ssl&auth_mode=login&username=****&password=****
MAILER_URL=smtp://mail.gandi.net:587?encryption=tls&auth_mode=login&username=****&password=****我也直接在swiftmailer.yaml上试过
swiftmailer:
transport: gmail
username: ****@gmail.com
password: *******
host: localhost
port: 465
encryption: ssl
auth-mode: login
spool: { type: 'memory' }
stream_options:
ssl:
allow_self_signed: true
verify_peer: false
verify_peer_name: false我确实将我的google帐户设置为,启用了安全性较低的应用程序。所有gmail请求返回
预期响应代码235,但得到代码"535",与消息"535-5.7.8用户名和密码不被接受。
->我100%肯定我的gmail密码和帐户是正确的。
我的甘地请求回来
预期响应代码354,但得到代码"554",并有消息"554 5.5.1错误:无有效收件人“
->这里是发送电子邮件的php代码:
$message = (new \Swift_Message('Test'))
->setFrom('****@****.com')
->setTo('****@gmail.com')
->setBody(
$this->renderView(
'email/view.html.twig',
['name' => '****', 'surname' => '****']
),
'text/html'
);
try {
$result = $mailer->send($message);
}
catch (\Exception $e) {
var_dump($e->getMessage());
}所以我有个收信人和寄件人。
我正在当地工作的Macbook,有没有任何软,可以阻止电子邮件离开,或破坏我发送的电子邮件?
发布于 2019-04-20 05:13:02
SMTP错误消息将指示您试图发送(或发送)的电子邮件地址可能无效。确保电子邮件地址是实际有效的收件箱。
发布于 2019-07-17 19:14:43
确保您的密码不包含任何保留字符,如! * ' ( ) ; : @ & = + $ , / ?# |。
这里我的配置甘地邮件和Swiftmailer的工作。
swiftmailer.yaml
swiftmailer:
url: '%env(MAILER_URL)%'
spool: { type: 'memory' }小心,在本地,您需要删除spool: { type: 'memory'}立即发送电子邮件消息。
.env
MAILER_URL=smtp://mail.gandi.net:465?encryption=ssl&auth_mod=login&username=user@mail.com&password=password1234此外,您还可以使用以下命令行直接尝试配置:php bin/console swiftmailer:email:send
https://stackoverflow.com/questions/54696891
复制相似问题