开发者

How can Drupal users receive emails from outside Drupal?

开发者 https://www.devze.com 2022-12-19 19:40 出处:网络
I have a basic Drupal install and a bunch of 开发者_开发技巧users. How could my Drupal users receive e-mails from the outside world at their address (e.g. user@my-drupal-install.com)?

I have a basic Drupal install and a bunch of 开发者_开发技巧users.

How could my Drupal users receive e-mails from the outside world at their address (e.g. user@my-drupal-install.com)?

Thank you!


Drupal is a system for serving web pages, it does not run mail servers. If there is no mail server present on your system, you will need to install one. Once you have a mail server running, you can install a Drupal module such as Webmail Plus to provide a webmail interface for your users.


For the case you describe I think the best way to handle this is to set up a mail server with automatic forwarding, and run a batch process once a day or so that extracts the usernames and their e-mail addresses from your Drupal database's user table. Drupal itself doesn't need to be involved in the actual sending and receiving of e-mail at all.

If you are using the Drupal username as the first part of the e-mail address then your export script could just run a query like

SELECT name, mail
FROM  `users` 
WHERE 1 

as part of a shell script that populates a table of e-mail addresses to forward to. For the correct formatting and configuration of such a file you'll really need to dig into the documentation of your e-mail server.


Thanks all!

You've put me in the right direction and I ended up writing a script that reads the Drupal's users table and configures the mail server accordingly. I've turned it into a small Python library for WebFaction, available at http://code.google.com/p/drupal2mail.

Hope it's useful for some!

0

精彩评论

暂无评论...
验证码 换一张
取 消