PHP电子邮件表单,如何绕过主机限制? (仅当托管发送者/接收者时才能发送/接收)

发布于 2024-10-20 14:35:08 字数 1026 浏览 4 评论 0原文

我的网络主机仅允许发送/接收电子邮件(如果发件人或收件人由它们托管)。 (freehostia.com)

由于我网站的工作方式,这对我(我假设其他人)来说是一个巨大的劣势。

(我的网站:我有一个分类网站,客户 A 用她的电子邮件发布广告,客户 B 通过电子邮件表单回复他的电子邮件。这两封电子邮件都不是由我的主机托管的。)

我询问是否可以使用外部 SMTP 服务器(例如Gmail)来绕过限制,他们说“即使您为您的域设置了外部 MX 记录,如果您不使用我们的托管帐户中的邮箱,您也将无法通过邮件论坛发送电子邮件作为发件人或收件人。”

理论上的解决方法:

  1. 将我的托管电子邮件自动输入并隐藏到表单的“电子邮件”部分中。
  2. 有一个新部分供客户输入电子邮件
  3. 。发送消息时,将客户消息和电子邮件嵌入到默认消息中。它看起来像这样:

收件人:[电子邮件受保护]

来自:[电子邮件受保护]

主题:您已收到一条消息!

正文:Blahblahblah(客户留言)blahblah。要回复,请发送电子邮件至:[email protected]


对于造成的混乱,我们深表歉意。这行得通吗?我应该放弃吗?我真的很喜欢我的主人,但我应该更换吗?或者有更好的解决方法吗?

My webhost ONLY allows sending/recieving emails IF either the sender or reciever is hosted with them. (freehostia.com)

This is a huge disadvantage to me (and I'm assuming everyone else), because of the way my website works.

(My website: I have a classifieds website where CustomerA posts an ad with her email and CustomerB replies via the email form with his email. Neither email is hosted with my host.)

I asked if I could use an external SMTP server (such as Gmail) to bypass the limitations, and they said "Even if you set an external MX record for your domain you will not be able to send e-mails via your mail forum, if you do not use a mailbox from your hosting account with us as a sender or recipient."

Theoretical Workaround:

  1. Auto-enter and hide my hosted email into the "email" section of the form
  2. Have a new section for customer to input their email
  3. When a message is sent, embed customers message and email into a default message. It will look like this:

To: [email protected]

From: [email protected]

Subject: You have recieved a message!

Body: Blahblahblah (customers message) blahblah. To reply, email: [email protected]


Sorry about all the confusion. Would this work? Should I give up? I really like my host, but should I switch? Or is there a better workaround?

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

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

发布评论

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

评论(2

〃温暖了心ぐ 2024-10-27 14:35:08

虽然您不需要通过不同的服务器发送,但您可以只发送给您需要的人并将回复设置为您想要的任何地址。

邮件功能允许您设置自己的标头作为最终参数。

$headers = 'Reply-To: someone@some_other_domain.com\n\r';
mail($to, $subject, $body, $headers);

While you don't need to send through a different server, you can just send to whom you need and set the reply to any address you want.

The mail function allows you to set your own headers as a final parameter.

$headers = 'Reply-To: someone@some_other_domain.com\n\r';
mail($to, $subject, $body, $headers);
违心° 2024-10-27 14:35:08

您可以设置回复地址。

这样,即使电子邮件是从您的地址发送的,当收件人点击回复时,它也会创建一封电子邮件到回复中给出的地址。

我不确定您使用什么来发送邮件,但 PHP 文档邮件函数中有一些示例 - http://php.net/manual/en/function.mail.php

You can set the reply-to address.

That way even though the email is sent from your address, when the recipient hits reply it creates an email to the address given in the reply-to.

I'm not sure what you are using to send mail but there are some examples in the PHP documentation mail function - http://php.net/manual/en/function.mail.php

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