我怎样才能发送消息?

发布于 2024-08-17 08:01:13 字数 44 浏览 3 评论 0原文

我已经在 php 中编写了邮件发送程序。但是我如何通过本地服务器发送邮件?

I have programmed for mailing in php.but how can i send mail through local server?

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

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

发布评论

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

评论(4

咋地 2024-08-24 08:01:13

如果仅从脚本发送邮件,功能齐全的 SMTP 服务器就显得有些过分了。 SMTP 用于连接到服务器并发送邮件的客户端。

要从脚本发送邮件,请使用 sendmail 或 postfix

http://php.net/manual /en/function.mail.php

A full-on SMTP server would be overkill for just mailing from a script. SMTP is for clients connecting to the server and sending mail.

To send mail from a script, use sendmail or postfix

http://php.net/manual/en/function.mail.php

星軌x 2024-08-24 08:01:13

您还可以查看 php.net 有关邮件的信息。祝你好运!

You could also take a look at php.net regarding mailing. Good luck!

你爱我像她 2024-08-24 08:01:13

假设服务器已经设置为具有 SMTP 和/或 sendmail,那么您最有可能正在寻找的是 mail( )函数

基本用法如下:

mail( '[email protected]', 'The subject', 'A short or long message' );

发送长消息时,使用 wordwrap() 函数,确保消息被客户端正确显示。

$message = wordwrap($message, 70);

当然,如果这不起作用,那么您可能需要联系您的服务器管理员,以确保一切设置正确以允许您发送电子邮件。

Assuming the server is already set up to have either SMTP and/or sendmail, then most likely what you are looking for is the mail() function.

Basic usage for that would be something like this:

mail( '[email protected]', 'The subject', 'A short or long message' );

when sending a long message, use the wordwrap() function, to ensure that the message is broken displayed properly by the client.

$message = wordwrap($message, 70);

Of course, if this does not work, then you may need to contact your server administrator to make sure that everything is correctly setup to allow you to send email.

柏拉图鍀咏恒 2024-08-24 08:01:13

您需要设置 SMTP 服务器。您可以使用 iis 来实现此目的。

You need to setup an SMTP server. You can use iis for this purpose.

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