SMTP Error: Could not authenticate

博客详细描述了在Moodle 2.0版本中遇到的SMTP邮件发送失败问题,特别是当论坛帖子发送时,订阅用户无法收到邮件。作者通过在moodlelib.php文件中添加一行代码解决了这一问题,即设置$mailer->SMTPSecure为tls。

HI

We currently have three Moodle 2.0 (build 20110209) installations and receive the 'SMTP Error:Could not authenticate' and none of the subscribed users receive an email when a forum post is sent from these installations.  I, as an admin, recieve the following message within an email:

Insert into log table failed at Wednesday 16th of February 2011 11:57:28 AM.

 It is possible that your disk is full.

The failed query parameters are:

array (

  'time' => 1297857448,

  'userid' => '2',

  'course' => '1',

  'ip' => '10.10.10.14',

  'module' => 'library',

  'cmid' => 0,

  'action' => 'mailer',

  'url' => NULL,

  'info' => 'ERROR: SMTP Error: Could not authenticate.',

)

When I look at the cron log, it has the following message:

<br />SMTP Error: Could not authenticate.
ERROR: SMTP Error: Could not authenticate.
++ Error: Could not insert a new entry to the Moodle log ++
* line 1691 of /lib/datalib.php: call to debugging()
* line 4742 of /lib/moodlelib.php: call to add_to_log()
* line 63 of /message/output/email/message_output_email.php: call to email_to_user()
* line 152 of /lib/messagelib.php: call to message_output_email->send_message()
* line 644 of /mod/forum/lib.php: call to message_send()
* line 87 of /lib/cronlib.php: call to forum_cron()
* line 79 of /admin/cron.php: call to cron_run()
</pre>++ Error calling message processor email ++
* line 153 of /lib/messagelib.php: call to debugging()
* line 644 of /mod/forum/lib.php: call to message_send()
* line 87 of /lib/cronlib.php: call to forum_cron()
* line 79 of /admin/cron.php: call to cron_run()
Error: mod/forum/lib.php forum_cron(): Could not send out mail for id 36 to user 28 (blahblah@somemailco.co.uk) .. not trying again.
post 36: another test
0 users were sent post 36, 'another test'

 

We have Moodle v 1.9 on the same server with the exact same SMTP settings and this install is sending emails accordingly.

Ali

-----------------------------------------------------------------------------

Hi, I just solved my problem and want to share the solution with you.

 

It was a line addition to moodlelib.php  ( in the lib directory)

Find the line :

$mailer->IsSMTP();

and under this line , insert

$mailer->SMTPSecure = "tls";

if you use TLS of course. After this, e-mail system was working without any problems.

I hope it helps. smile

转载于:https://www.cnblogs.com/laipDIDI/articles/2225632.html

### ascp身份验证失败问题的解决方案 当遇到 `ascp failed to authenticate key passphrase error` 时,通常是因为 Aspera 客户端(ascp)在使用 SSH 密钥进行身份验证时未能正确识别或解析密钥的密码短语。以下是可能导致该问题的原因及解决方法: #### 1. 密钥文件格式不正确 SSH 密钥文件可能未以正确的格式保存,或者密钥已损坏。确保私钥文件符合 OpenSSH 格式,并且没有多余的换行符或空格[^1]。 ```bash ssh-keygen -p -f ~/.ssh/private_key -m PEM ``` 上述命令将重新生成私钥并确保其格式为 PEM,这是许多系统所要求的标准格式。 #### 2. 密码短语输入错误 如果私钥受密码保护,则需要提供正确的密码短语。在运行 ascp 命令时,可以通过以下方式指定密码短语: - 使用环境变量 `ASCP_SSH_KEY_PASSPHRASE` 设置密码短语。 - 确保密码短语中没有多余空格或特殊字符,这些可能会导致解析失败[^2]。 ```bash export ASCP_SSH_KEY_PASSPHRASE="your_passphrase_here" ``` #### 3. 配置文件中的密钥路径错误 检查 ascp 的配置文件是否正确指定了私钥路径。默认情况下,ascp 使用 `~/.ssh/id_rsa` 作为私钥文件。如果使用其他路径,请通过 `-K` 参数明确指定密钥文件的位置。 ```bash ascp -P33001 -i /path/to/private_key file.txt user@remote_host:/destination/ ``` #### 4. 权限问题 私钥文件的权限设置不当也可能导致身份验证失败。私钥文件应仅对所有者可读,其他用户无访问权限。 ```bash chmod 600 /path/to/private_key ``` #### 5. SSH 代理问题 如果使用 SSH 代理管理密钥,确保代理已加载正确的密钥并启用了密码短语缓存功能。 ```bash ssh-add -K /path/to/private_key ``` 此命令会将私钥添加到 SSH 代理中,并缓存密码短语以便后续使用[^3]。 #### 6. 版本兼容性 确保 ascp 和服务器端的 Aspera Connect Server 版本兼容。版本不匹配可能导致身份验证失败或其他连接问题。 ```bash ascp --version ``` 如果发现版本过旧,建议升级至最新稳定版本。 --- ### 示例代码:完整 ascp 命令示例 以下是一个完整的 ascp 命令示例,包含所有必要参数: ```bash export ASCP_SSH_KEY_PASSPHRASE="your_passphrase_here" ascp -P33001 -l100M -i /path/to/private_key local_file user@remote_host:/destination/ ``` - `-P33001`: 指定端口号。 - `-l100M`: 限制传输速率。 - `-i`: 指定私钥文件路径。 ---
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符  | 博主筛选后可见
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值