While you could do this with PHP alone, that wouldn’t be a good idea. If you need to receive emails to your domain, there are two ways of going about it:
-
Local
sendmail
: you need a server with open port 25; you’ll need to configure MX records in DNS and properly configure your sendmail to avoid all sorts of security issues. You could, of course, write an SMTP server in PHP, but I wouldn’t recommend it. -
SAAS approach (e.g. google apps is one example). If you don’t need to more than a handful of users, then google apps is free to use and is very easy to set up. Google doesn’t tell you any more that they have a free version – they want some money from you, namely $50 per user per year, but if you go to this page directly: https://www.google.com/a/cpanel/standard/new3 – it apparently still allows you to sign in. There are other providers of hosted email – try search the web for it.
solved Receive emails on my website/domain from all other domains [closed]