最新消息:20210917 已从crifan.com换到crifan.org

【未解决】阿里云ECS服务器CentOS中php用465端口发送邮件

服务器 crifan 940浏览 0评论
折腾:
【记录】阿里云服务器中申请解封发送邮件的25号端口
后,只能去试试465端口了。去参考:
使用SSL加密465端口发信样例及Demo_安全问题_常见问题_云虚拟主机-阿里云
demo代码:
修改内容。
但是需要先去搞懂:
腾讯企业邮中,的smtp服务器配置
接收服务器:imap.exmail.qq.com(使用SSL,端口号993)
发送服务器:smtp.exmail.qq.com(使用SSL,端口号465)
然后去测试能否发送邮件。
【已解决】PHPMailer的参数的含义
把改好的代码:
<?php

require 'PHPMailerAutoload.php';
require_once('class.phpmailer.php');
require_once("class.smtp.php");
$mail = new PHPMailer();

$mail->CharSet ="UTF-8"; //设定邮件编码,默认ISO-8859-1,如果发中文此项必须设置为 UTF-8
$mail->IsSMTP(); // 设定使用SMTP服务
$mail->SMTPAuth = true; // 启用 SMTP 验证功能
$mail->SMTPSecure = "ssl"; // 启用SSL
$mail->SMTPDebug = 2;
$mail->Host = "smtp.exmail.qq.com"; // SMTP 服务器
$mail->Port = 465; // SMTP服务器的端口号
$mail->Username = "crifan.li@xxx"; // SMTP服务器用户名
$mail->Password = “xxx"; // SMTP服务器密码
$mail->SetFrom('xxx@163.com', 'xxx'); // 设置发件人地址和名称
$mail->AddReplyTo("crifan.li@xxx"); // 设置邮件回复人地址和名称
$mail->Subject = '测试xxx发送给xxx'; // 设置邮件标题
$mail->AltBody = "为了查看该邮件,请切换到支持 HTML 的邮件客户端"; // 可选项,向下兼容考虑
$mail->MsgHTML('<html>用html格式,测试从xxx@163.com发送给crifan.li@xxx</html>'); // 设置邮件内容
$mail->AddAddress('xxx@xxx.com', "xxx@xxx.com");
//$mail->AddAttachment("images/phpmailer.gif"); // 附件
if(!$mail->Send()) {
echo "发送失败:" . $mail->ErrorInfo;
} else {
echo "恭喜,邮件发送成功!";
}

?>
放到服务器上,看看能否正常发送邮件。
http://xxx/php/PHPMailer/testmail.php
结果发送失败:
2018-03-27 07:11:05 SERVER -> CLIENT: 220 smtp.qq.com Esmtp QQ Mail Server 

2018-03-27 07:11:05 CLIENT -> SERVER: EHLO www.xxx 

2018-03-27 07:11:05 SERVER -> CLIENT: 250-smtp.qq.com 

250-PIPELINING 

250-SIZE 73400320 

250-AUTH LOGIN PLAIN 

250-AUTH=LOGIN 

250-MAILCOMPRESS 

250 8BITMIME 

2018-03-27 07:11:05 CLIENT -> SERVER: AUTH LOGIN 

2018-03-27 07:11:05 SERVER -> CLIENT: 334 VXNlcm5hbWU6 

2018-03-27 07:11:05 CLIENT -> SERVER: Y3JpZmFuLmxpQG5hdHVybGluZy5jb20= 

2018-03-27 07:11:05 SERVER -> CLIENT: 334 UGFzc3dvcmQ6 

2018-03-27 07:11:05 CLIENT -> SERVER: TkB0dXIxaW5n 

2018-03-27 07:11:05 SERVER -> CLIENT: 535 Error: authentication failed, system busy 

2018-03-27 07:11:05 SMTP ERROR: Password command failed: 535 Error: authentication failed, system busy 

2018-03-27 07:11:05 SMTP Error: Could not authenticate. 

2018-03-27 07:11:05 CLIENT -> SERVER: QUIT 

2018-03-27 07:11:05 SERVER -> CLIENT: 221 Bye 

2018-03-27 07:11:05 SMTP connect() failed. https://github.com/PHPMailer/PHPMailer/wiki/Troubleshooting 

发送失败:SMTP connect() failed. https://github.com/PHPMailer/PHPMailer/wiki/Troubleshooting 
结果是:
验证失败
突然发现,实例代码和:
https://github.com/PHPMailer/PHPMailer
比,中少了:
$mail->SMTPSecure = 'tls';                            // Enable TLS encryption, `ssl` also accepted
去加上再试试:
$mail->SMTPSecure = 'ssl'; // 设置使用ssl加密方式登录鉴权
$mail->Port = 465; // SMTP服务器的端口号
结果,错误依旧:
不行的话,再去试试:
$mail->SMTPSecure = 'tls'; // Enable TLS encryption, `ssl` also accepted
$mail->Port = 465; // SMTP服务器的端口号
结果:
好像发送的很慢很慢的样子:
一直在等待,好半天都没反应。感觉彻底没有响应。
最后是404:
PHPMailer mail fail
php – PHPMailer fails to send – Stack Overflow
在此之前,发现错误了:
$mail->AddAddress('xxx@xxx.com', "xxx@xxx.com");
此处的接受人是错误的。。。
改为正确的试试:
<?php

require 'PHPMailerAutoload.php';
require_once('class.phpmailer.php');
require_once("class.smtp.php");
$mail = new PHPMailer();

$mail->CharSet ="UTF-8"; //设定邮件编码,默认ISO-8859-1,如果发中文此项必须设置为 UTF-8
$mail->IsSMTP(); // 设定使用SMTP服务
$mail->SMTPAuth = true; // 启用 SMTP 验证功能
$mail->SMTPSecure = "ssl"; // 启用SSL
$mail->SMTPDebug = 2;
$mail->Host = "smtp.exmail.qq.com"; // SMTP 服务器
// $mail->SMTPSecure = 'ssl'; // 设置使用ssl加密方式登录鉴权
$mail->SMTPSecure = 'tls'; // Enable TLS encryption, `ssl` also accepted
$mail->Port = 465; // SMTP服务器的端口号
$mail->Username = "crifan.li@xxx"; // SMTP服务器用户名
$mail->Password = “xxx"; // SMTP服务器密码
$mail->SetFrom('xxx@163.com', 'xxx'); // 设置发件人地址和名称
$mail->AddAddress('crifan.li@xxx');
// $mail->AddReplyTo("crifan.li@xxx"); // 设置邮件回复人地址和名称
$mail->Subject = '测试xxx发送给xxx'; // 设置邮件标题
$mail->AltBody = "为了查看该邮件,请切换到支持 HTML 的邮件客户端"; // 可选项,向下兼容考虑
$mail->MsgHTML('<html>用html格式,测试从xxx@163.com发送给crifan.li@xxx</html>'); // 设置邮件内容
//$mail->AddAttachment("images/phpmailer.gif"); // 附件
if(!$mail->Send()) {
echo "发送失败:" . $mail->ErrorInfo;
} else {
echo "恭喜,邮件发送成功!";
}

?>
结果:
也是半天没反应。。。
最后还是404
难道是:
此处必须保证:
发送方,必须是自己(所用到的smtp的服务器)才行?
去把发件人设置为自己试试:
$mail->SetFrom('crifan.li@xxx', 'crifan_xxx'); // 设置发件人地址和名称
$mail->AddAddress('xxx@163.com');
// $mail->AddReplyTo("crifan.li@xxx"); // 设置邮件回复人地址和名称
$mail->Subject = '测试xxx发送给xxx'; // 设置邮件标题
$mail->MsgHTML('<html>用html格式,测试从crifan.li@xxx发送给xxx@163.com</html>'); // 设置邮件内容
结果:
问题依旧。还是404
PHPMailer mail  404
php mailer error 404 wrong code – Stack Overflow
forms – PHP Mailer is giving me error 404 – Stack Overflow
404 Problems “scripts/PHPMailer/PHPMailerAutoload.php” not found and request · Issue #106 · therecluse26/PHP-Login
404 error – How can I send an email in my plugin? – WordPress Development Stack Exchange
算了,还是去下载官网:
PHPMailer/PHPMailer: The classic email sending library for PHP
最新代码,然后再去测试吧
怕万一之前的demo代码有问题。
https://github.com/PHPMailer/PHPMailer
结果官网demo中说:
If you’re using XOAUTH2 you will need src/OAuth.php as well as the Composer dependencies for the services you wish to authenticate with. Really, it’s much easier to use Composer!
而此处,我好像算是用到了Auth?
但是却没有找到:
require ‘vendor/autoload.php’;
所以,放弃。
继续用之前代码去测试,改为:
// require 'PHPMailerAutoload.php';
require_once('PHPMailerAutoload.php');
require_once('class.phpmailer.php');
require_once("class.smtp.php");
结果:
问题依旧,404
PHPMailer mail  404 not found
email – php mail() function leading to a 404 file not found page – Stack Overflow
php – PHPMailer not working with SMTP Server – Stack Overflow
去加上:
<?php
error_reporting(E_ALL);
ini_set('display_errors','1');
看看能否输出啥错误信息,帮忙调试
错误依旧,还是404
把故意把465改回25,看看是否可以。
去服务器上把php的mail的设置改为465端口试试:
;smtp_port = 25
smtp_port = 465
再重启php
另外,发现有个大问题:
之前旧的代码中,很多函数名和参数,都错了:
比如:
SetFrom – 》setFrom
MsgHTML -〉 isHTML + Body
然后改为正确的参数:
<?php
error_reporting(E_ALL);
ini_set('display_errors','1');

require 'PHPMailerAutoload.php';
// require_once('PHPMailerAutoload.php');
require_once('class.phpmailer.php');
require_once("class.smtp.php");
$mail = new PHPMailer();

//Server settings
$mail->SMTPDebug = 2;
$mail->isSMTP(); // 设定使用SMTP服务
$mail->Host = "smtp.exmail.qq.com"; // SMTP 服务器
$mail->SMTPAuth = true; // 启用 SMTP 验证功能
$mail->Username = "crifan.li@xxx"; // SMTP服务器用户名
$mail->Password = “xxxx000"; // SMTP服务器密码
// $mail->SMTPSecure = 'ssl'; // 设置使用ssl加密方式登录鉴权
$mail->SMTPSecure = 'tls'; // Enable TLS encryption, `ssl` also accepted
$mail->Port = 465; // SMTP服务器的端口号

//Recipients
$mail->setFrom('crifan.li@xxx', 'crifan_xxx'); // 设置发件人地址和名称
$mail->addAddress('xxx@163.com');
// $mail->addReplyTo("crifan.li@xxx"); // 设置邮件回复人地址和名称

//Content
$mail->CharSet ="UTF-8"; //设定邮件编码,默认ISO-8859-1,如果发中文此项必须设置为 UTF-8
$mail->isHTML(true); // Set email format to HTML
$mail->Subject = '测试xxx发送给xxx'; // 设置邮件标题
$mail->Body = '用html格式,测试从<b>crifan.li@xxx</b>发送给<b>xxx@163.com</b>';
// $mail->MsgHTML('<html>用html格式,测试从crifan.li@xxx发送给xxx@163.com</html>'); // 设置邮件内容
//$mail->AddAttachment("images/phpmailer.gif"); // 附件
$mail->AltBody = "为了查看该邮件,请切换到支持 HTML 的邮件客户端"; // 可选项,向下兼容考虑

if(!$mail->Send()) {
echo "发送失败:" . $mail->ErrorInfo;
} else {
echo "恭喜,邮件发送成功!";
}

?>
结果:
发现个问题:
此处故意把密码搞错了:
结果竟然还是无响应
-》而不是之前的错误提示,提示授权验证失败
所以很是诡异,感觉是服务器本身有问题了?
或者是腾讯的邮箱系统,本身忽略,禁止掉了我们的请求?
去重启自己的服务器
还是不行。
把tls去掉,看看效果
换用163的smtp邮件服务器试试
163中只有smtp服务器,竟然找不到端口号,。。。
163邮箱 smtp 端口
网易邮箱帮助中心 – 客户端设置
163免费邮客户端设置的POP3、SMTP、IMAP地址-163邮箱常见问题
smtp的端口 不加密25,加密:465或994
然后设置了163的各种配置:
<?php
error_reporting(E_ALL);
ini_set('display_errors','1');

require 'PHPMailerAutoload.php';
// require_once('PHPMailerAutoload.php');
require_once('class.phpmailer.php');
require_once("class.smtp.php");
$mail = new PHPMailer();

//Server settings
$mail->SMTPDebug = 2;
$mail->isSMTP(); // 设定使用SMTP服务
// $mail->Host = "smtp.exmail.qq.com"; // SMTP 服务器
$mail->Host = "smtp.163.com"; // SMTP 服务器
$mail->SMTPAuth = true; // 启用 SMTP 验证功能
// $mail->Username = "crifan.li@xxx"; // SMTP服务器用户名
// $mail->Password = “xxxx"; // SMTP服务器密码
$mail->Username = "xxx@163.com"; // SMTP服务器用户名
$mail->Password = “xxxxx"; // SMTP服务器密码
// $mail->SMTPSecure = 'ssl'; // 设置使用ssl加密方式登录鉴权
$mail->SMTPSecure = 'tls'; // Enable TLS encryption, `ssl` also accepted
$mail->Port = 465; // SMTP服务器的端口号

//Recipients
// $mail->setFrom('crifan.li@xxx', 'crifan_xxx'); // 设置发件人地址和名称
// $mail->addAddress('xxx@163.com');
$mail->setFrom('xxx@163.com', "xxx"); // 设置发件人地址和名称
$mail->addAddress('crifan.li@xxx');
// $mail->addReplyTo("crifan.li@xxx"); // 设置邮件回复人地址和名称

//Content
$mail->CharSet ="UTF-8"; //设定邮件编码,默认ISO-8859-1,如果发中文此项必须设置为 UTF-8
$mail->isHTML(true); // Set email format to HTML
$mail->Subject = '测试xxx发送给xxx'; // 设置邮件标题
$mail->Body = '用html格式,测试从<b>xxx@163.com</b>发送给<b>crifan.li@xxx</b>';
// $mail->MsgHTML('<html>用html格式,测试从crifan.li@xxx发送给xxx@163.com</html>'); // 设置邮件内容
//$mail->AddAttachment("images/phpmailer.gif"); // 附件
$mail->AltBody = "为了查看该邮件,请切换到支持 HTML 的邮件客户端"; // 可选项,向下兼容考虑

if(!$mail->Send()) {
echo "发送失败:" . $mail->ErrorInfo;
} else {
echo "恭喜,邮件发送成功!";
}

?>
结果:
2018-03-27 08:32:41 SERVER -> CLIENT: 

2018-03-27 08:32:41 SMTP NOTICE: EOF caught while checking if connected 

2018-03-27 08:32:41 SMTP Error: Could not connect to SMTP host. 

2018-03-27 08:32:41 SMTP connect() failed. https://github.com/PHPMailer/PHPMailer/wiki/Troubleshooting 

发送失败:SMTP connect() failed. https://github.com/PHPMailer/PHPMailer/wiki/Troubleshooting 
然后换用授权码:
xxx@163.com的授权码:shouquan163
然后去试试 授权码登录是否可以
然后用授权码,是可以发送的:
[root@xxx PHPMailer]# php -f testmail.php 
2018-03-27 08:42:04     SERVER -> CLIENT: 220 163.com Anti-spam GT for Coremail System (163com[20141201])
2018-03-27 08:42:04     CLIENT -> SERVER: EHLO 
xxx
2018-03-27 08:42:04     SERVER -> CLIENT: 250-mail
                                          250-PIPELINING
                                          250-AUTH LOGIN PLAIN
                                          250-AUTH=LOGIN PLAIN
                                          250-coremail 1Uxr2xKj7kG0xkI17xGrU7I0s8FY2U3Uj8Cz28x1UUUUU7Ic2I0Y2UFaAZPHUCa0xDrUUUUj
                                          250-STARTTLS
                                          250 8BITMIME
2018-03-27 08:42:04     CLIENT -> SERVER: AUTH LOGIN
2018-03-27 08:42:04     SERVER -> CLIENT: 334 dXNlcm5hbWU6
2018-03-27 08:42:04     CLIENT -> SERVER: Y3JpZmFuMjAwM0AxNjMuY29t
2018-03-27 08:42:04     SERVER -> CLIENT: 334 UGFzc3dvcmQ6
2018-03-27 08:42:04     CLIENT -> SERVER: c2hvdXF1YW4xNjM=
2018-03-27 08:42:04     SERVER -> CLIENT: 235 Authentication successful
2018-03-27 08:42:04     CLIENT -> SERVER: MAIL FROM:<
xxx@163.com
>
2018-03-27 08:42:04     SERVER -> CLIENT: 250 Mail OK
2018-03-27 08:42:04     CLIENT -> SERVER: RCPT TO:<
crifan.li@xxx
>
2018-03-27 08:42:04     SERVER -> CLIENT: 250 Mail OK
2018-03-27 08:42:04     CLIENT -> SERVER: DATA
2018-03-27 08:42:04     SERVER -> CLIENT: 354 End data with <CR><LF>.<CR><LF>
2018-03-27 08:42:04     CLIENT -> SERVER: Date: Tue, 27 Mar 2018 16:42:04 +0800
2018-03-27 08:42:04     CLIENT -> SERVER: To: 
crifan.li@xxx
2018-03-27 08:42:04     CLIENT -> SERVER: From: xxx <
xxx@163.com
>
2018-03-27 08:42:04     CLIENT -> SERVER: Subject: =?UTF-8?B?5rWL6K+VY3JpZmFuMjAwM+WPkemAgee7mW5hdHVybGluZw==?=
2018-03-27 08:42:04     CLIENT -> SERVER: Message-ID: <
d3ba0b905244bfcbfa09f79cfc132157@xxx
>
2018-03-27 08:42:04     CLIENT -> SERVER: X-Mailer: PHPMailer 5.2.24 (
https://github.com/PHPMailer/PHPMailer
)
2018-03-27 08:42:04     CLIENT -> SERVER: MIME-Version: 1.0
2018-03-27 08:42:04     CLIENT -> SERVER: Content-Type: multipart/alternative;
2018-03-27 08:42:04     CLIENT -> SERVER:       boundary="b1_d3ba0b905244bfcbfa09f79cfc132157"
2018-03-27 08:42:04     CLIENT -> SERVER: Content-Transfer-Encoding: 8bit
2018-03-27 08:42:04     CLIENT -> SERVER:
2018-03-27 08:42:04     CLIENT -> SERVER: This is a multi-part message in MIME format.
2018-03-27 08:42:04     CLIENT -> SERVER:
2018-03-27 08:42:04     CLIENT -> SERVER: --b1_d3ba0b905244bfcbfa09f79cfc132157
2018-03-27 08:42:04     CLIENT -> SERVER: Content-Type: text/plain; charset=UTF-8
2018-03-27 08:42:04     CLIENT -> SERVER: Content-Transfer-Encoding: 8bit
2018-03-27 08:42:04     CLIENT -> SERVER:
2018-03-27 08:42:04     CLIENT -> SERVER: 涓轰ョ璇ラ欢锛版 HTML 欢瀹㈡绔
2018-03-27 08:42:04 CLIENT -> SERVER:
2018-03-27 08:42:04     CLIENT -> SERVER:
2018-03-27 08:42:04     CLIENT -> SERVER: --b1_d3ba0b905244bfcbfa09f79cfc132157
2018-03-27 08:42:04     CLIENT -> SERVER: Content-Type: text/html; charset=UTF-8
2018-03-27 08:42:04     CLIENT -> SERVER: Content-Transfer-Encoding: 8bit
2018-03-27 08:42:04     CLIENT -> SERVER:
2018-03-27 08:42:04     CLIENT -> SERVER: ㄨtml煎锛璇<b>
xxx@163.com
</b>缁b>
crifan.li@xxx
</b>
2018-03-27 08:42:04     CLIENT -> SERVER:
2018-03-27 08:42:04     CLIENT -> SERVER:
2018-03-27 08:42:04     CLIENT -> SERVER:
2018-03-27 08:42:04     CLIENT -> SERVER: --b1_d3ba0b905244bfcbfa09f79cfc132157--
2018-03-27 08:42:04     CLIENT -> SERVER:
2018-03-27 08:42:04     CLIENT -> SERVER: .
2018-03-27 08:42:05     SERVER -> CLIENT: 250 Mail OK queued as smtp10,DsCowABXYUvcA7pamFdWMA--.41736S2 1522140125
2018-03-27 08:42:05     CLIENT -> SERVER: QUIT
2018-03-27 08:42:05     SERVER -> CLIENT: 221 Bye
但是好像必须是
发送者是自己利用的smtp服务器的邮箱才行。
把ssl换用tls试试:
// $mail->SMTPSecure = 'ssl'; // 设置使用ssl加密方式登录鉴权
$mail->SMTPSecure = 'tls'; // Enable TLS encryption, `ssl` also accepted
不行:
[root@xxx PHPMailer]# php -f testmail.php 
2018-03-27 08:44:07     SERVER -> CLIENT:
2018-03-27 08:44:07     SMTP NOTICE: EOF caught while checking if connected
2018-03-27 08:44:07     SMTP Error: Could not connect to SMTP host.
2018-03-27 08:44:07     SMTP connect() failed. 
https://github.com/PHPMailer/PHPMailer/wiki/Troubleshooting
澶辫触锛MTP connect() failed. 
https://github.com/PHPMailer/PHPMailer/wiki/Troubleshooting
去试试:
把发件人写成别人的邮箱:
$mail->Host = "smtp.163.com"; // SMTP 服务器
$mail->SMTPAuth = true; // 启用 SMTP 验证功能
$mail->Username = "xxx@163.com"; // SMTP服务器用户名

$mail->setFrom('crifan.li@xxx', 'crifan_xxx'); // 设置发件人地址和名称
$mail->addAddress('xxx@163.com');
看看是否可以:
果然有限制:
[root@xxx PHPMailer]# php -f testmail.php 
2018-03-27 08:51:08     SERVER -> CLIENT: 220 163.com Anti-spam GT for Coremail System (163com[20141201])
2018-03-27 08:51:08     CLIENT -> SERVER: EHLO 
xxx
2018-03-27 08:51:08     SERVER -> CLIENT: 250-mail
                                          250-PIPELINING
                                          250-AUTH LOGIN PLAIN
                                          250-AUTH=LOGIN PLAIN
                                          250-coremail 1Uxr2xKj7kG0xkI17xGrU7I0s8FY2U3Uj8Cz28x1UUUUU7Ic2I0Y2UrH4182UCa0xDrUUUUj
                                          250-STARTTLS
                                          250 8BITMIME
2018-03-27 08:51:08     CLIENT -> SERVER: AUTH LOGIN
2018-03-27 08:51:08     SERVER -> CLIENT: 334 dXNlcm5hbWU6
2018-03-27 08:51:08     CLIENT -> SERVER: Y3JpZmFuMjAwM0AxNjMuY29t
2018-03-27 08:51:08     SERVER -> CLIENT: 334 UGFzc3dvcmQ6
2018-03-27 08:51:08     CLIENT -> SERVER: c2hvdXF1YW4xNjM=
2018-03-27 08:51:08     SERVER -> CLIENT: 235 Authentication successful
2018-03-27 08:51:08     CLIENT -> SERVER: MAIL FROM:<
crifan.li@xxx
>
2018-03-27 08:51:09     SERVER -> CLIENT: 553 Mail from must equal authorized user
2018-03-27 08:51:09     SMTP ERROR: MAIL FROM command failed: 553 Mail from must equal authorized user
2018-03-27 08:51:09     The following From address failed: 
crifan.li@xxx
 : MAIL FROM command failed,Mail from must equal authorized user
                                          ,553,SMTP server error: MAIL FROM command failed Detail: Mail from must equal authorized user
                                           SMTP code: 553
澶辫触锛he following From address failed: 
crifan.li@xxx
 : MAIL FROM command failed,Mail from must equal authorized user
,553,SMTP server error: MAIL FROM command failed Detail: Mail from must equal authorized user
 SMTP code: 553SMTP server error: MAIL FROM command failed Detail: Mail from must equal authorized user
 SMTP code: 5532018-03-27 08:51:09      CLIENT -> SERVER: QUIT
2018-03-27 08:51:09     SERVER -> CLIENT: 221 Bye
即:
Mail from must equal authorized user
必须是发送邮箱的人才能收到
然后试了试:
是可以收到邮件的了:
但是抽空还是要去测试测试:
从xxx发送给另外一个xxx的账号,看看是否可以。其中利用到qq的smtp的邮件服务器。

转载请注明:在路上 » 【未解决】阿里云ECS服务器CentOS中php用465端口发送邮件

发表我的评论
取消评论

表情

Hi,您需要填写昵称和邮箱!

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址
92 queries in 0.201 seconds, using 23.39MB memory