Creating email address via PHP or any other script

放肆的年华 提交于 2019-11-30 05:45:47

问题


I need to create proxy email address for my users. The email addresses will look like user1234@domain.com but preferably I want better looking email addresses such as first.last@domain.com. Email is sent to this address should forward to the user's real email address that is not suspposed to be exposed (e.g. first.last@hotmail.com). There is no need to create a POP3 mailbox. Emails sent to regular email accounts (e.g. info@domain.com) should go to the correct POP3 mailbox. I would prefer a PHP+MySQL solution and I also want to avoid tampering with server configuration as much as possible.

I've seen such things on Facebook and Blogger. For example Blogger gives you an email address at which you can send emails and they become published as blog posts. Facebook gives you an email address at which you can send pictures (via cell phone) and they become published on your profile. Yahoo groups also give you an email address at which the sent emails are forwarded to subscribers.

So I need something similar only that I'll just forward the email to the real email address. I hope you get the point. Any help or guidance would be appreciated.


回答1:


This is mostly just about configuring your MTA correctly. Indeed you can do it completely using the configuration options available in most MTAs - here's how to do it with sendmail.

If you want to funnel it through your own script make sure all the valid addresses were getting routed correctly then set the default recipient for the domain (since you don't mention what MTA you are using, or even which OS it runs on, I can't guess how you do that) to forward to a handler script - all the handler script needs to do is to create a new email (don't try to forward the original) with the content (it'd be nice to include the original headers as an attachment to the new message).

Note that you'll need to put a new local address (@domain.com from your example) in the 'From'/'Reply-To' headers to avoid the message being classified as SPAM.

You really don't want to sink the emails on a local mailbox.



来源:https://stackoverflow.com/questions/4933811/creating-email-address-via-php-or-any-other-script

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!