如何从 php 文件发送电子邮件?

发布于 2024-12-28 11:28:47 字数 526 浏览 5 评论 0原文

我知道php中的邮件功能: mail ($to, $subject, $msg_body,$headers);

但由于我无法访问主机的 php.ini 文件,因此我获得了以下详细信息:

SMTP host: mailout.host.com 
Port: 25 SMTP
Username: [email protected]
SMTP Password: not required
Authentication: Disabled
Encryption: Disabled

如何使用这些详细信息发送电子邮件?

编辑:我使用了 Blender 指出的示例(如下),它似乎适用于除 gmail 之外的所有电子邮件。知道为什么吗?这与完全合格的地址有关吗?

I know about the mail function in php:
mail ($to, $subject, $msg_body,$headers);

But since I cannot access my host's php.ini file, I've been provided with the following details:

SMTP host: mailout.host.com 
Port: 25 SMTP
Username: [email protected]
SMTP Password: not required
Authentication: Disabled
Encryption: Disabled

How can I use these details to send out emails?

EDIT: I used example pointed by Blender (below) and it seems to work fine for all emails except gmail. Any idea why? Is it to do with Fully Qualified Address?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

已下线请稍等 2025-01-04 11:28:47

PHPMailer 是一个非常知名且广泛使用的替代方案

查看SMTP 邮件示例

PHPMailer is a very well known and widely used alternative

Check out the SMTP mail example

请持续率性 2025-01-04 11:28:47

您可以使用 SwiftMailer (http://swiftmailer.org/) 通过您可以登录的任何电子邮件帐户(包括 gmail)发送电子邮件。它非常强大,但确实有一个错误,即它会为包含大量 html 的电子邮件使用大量内存。

You can use SwiftMailer (http://swiftmailer.org/) to send out emails through any email account you can login to, including gmail. It's very robust, but does have a bug where it uses a lot of memory for emails that have a lot of html in them.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文