gpt4 book ai didi

php - 在 PHP 中发送邮件抛出 504 网关超时

转载 作者:塔克拉玛干 更新时间:2023-11-03 06:07:28 25 4
gpt4 key购买 nike

我在 Ubuntu 虚拟机上。

我有这个PHP

<?php

# --------------------------------------------------------------------------------
# Goal : send an email
# Run : curl 45.55.88.57/code/mail.php | php


$to = 'email@gmail.com';
$subject = '';
$message = 'hello';
$headers = 'From: john@gmail.com' . "\r\n" .
'Reply-To: john@gmail.com' . "\r\n" .
'X-Mailer: PHP/' . phpversion();

mail($to, $subject, $message, $headers);
?>

我运行了这个:

curl 45.55.88.57/code/mail.php  | php

我明白了

  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
Dload Upload Total Spent Left Speed
100 176 100 176 0 0 2 0 0:01:28 0:01:00 0:00:28 45
<html>
<head><title>504 Gateway Time-out</title></head>
<body bgcolor="white">
<center><h1>504 Gateway Time-out</h1></center>
<hr><center>nginx</center>
</body>
</html>

是我的代码有误,还是我的虚拟机有问题?

我没有收到任何电子邮件。

最佳答案

不要忘记设置您的 Gmail 设置。关注this tutorial用于设置谷歌 smtp。

关于php - 在 PHP 中发送邮件抛出 504 网关超时,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54959607/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com