setting mail server for development
Hello, Recently, I was trying to debug a patch for devel_issues.module: the problem was with the formatting of the mail notification. I had troubles working efficiently on that patch because my development platform is not configured to send mails (to myself!). In order to work on patches like this and for some contrib modules, I absolutely need to set myself up so that mails do get delivered. I am using Linux (currently Mandriva 2006, though I plan to switch to Debian). I have installed the packages postfix and postfix-mysql, though I am not sure I need such a full featured software for simple Drupal devel needs. I don't have a static IP, so I didn't know how to proceed with the postfix configuration. Also, I am concerned about security issues. The mail server needn't be open to the world. The mail sent don't need to leave my local computer. Is there a way to configure Apache (or whatever is handling this) to sent emails directly to a file somewhere on my computer? How do you handle such issues? Augustin.
At 12.54 16/12/2007, you wrote:
How do you handle such issues?
A rapid answer: in /etc/postfix/main.cf configure myhostname = <the hostname of your box> inet_interfaces = localhost # so that it won't be open to the world mydestination = $myhostname, localhost create a user mailtest on your box send mails to mailtest@<the hostname of your box> and read it via mail command or install pine or elm this should work (not tested, however I have a lot of servers configured with postfix and this should be the minimal configuration you need) Ciao! --8<-----------------------------------fnord----- Piermaria Maraziti piermaria@maraziti.it KALLISTI ICQ744473 MSN:kallisti@hotmail.it +3934735GILDA www.gilda.it www.eridia.it www.hovistocose.it
On Dec 16, 2007 12:54 PM, Augustin (Beginner) <drupal.beginner@wechange.org> wrote:
Recently, I was trying to debug a patch for devel_issues.module: the problem was with the formatting of the mail notification. I had troubles working efficiently on that patch because my development platform is not configured to send mails (to myself!).
How do you handle such issues?
A tip: Drupal can use an arbitrary mail backend. Look into http://api.drupal.org/api/function/drupal_mail_send/6 (in Drupal 6) or http://api.drupal.org/api/function/drupal_mail/5 (in Drupal 5). You can set the smtp_library variable to a file name, which Drupal will include and "send mail" with a drupal_mail_wrapper() function defined in that file. There you can log the mail to the database, a file or whatever. So all mail going out from Drupal can be nicely debugged locally. If you really need to send the mail over some server, as the name of the variable suggest, you can use an SMTP library and use any SMTP server you use otherwise to send mail, though I didn't have problems I solved this way though. Gabor
This is covered perfectly in http://www.drupal4hu.com/node/55 . In short: you set PHP to send mails to a file.
thats very useful ... also note that devel module ships with an smtp_library implementation which logs emails to the watchdog. you can review the contents using usual drupal web admin. On 12/16/07, Karoly Negyesi <karoly@negyesi.net> wrote:
This is covered perfectly in http://www.drupal4hu.com/node/55 . In short: you set PHP to send mails to a file.
Hello, On Sunday 16 December 2007 19:54, Augustin (Beginner) wrote:
I was trying to debug a patch for devel_issues.module
I obviously meant project_issues.module. Thanks everyone for your answers. I am now properly set up. I have documented everything you told me in the handbook: http://drupal.org/node/201981 Piermaria's notes allowed me to configure and start postfix, but after that, I still was confused about where to find the mails. (I tried with the command mail in the console...) I finally used chx's method, since it's the second one I tried and it worked. I had to install the package php-cli, though. It will be useful! So thanks again! If you want to add anything else, you may as well add it to the handbook directly: http://drupal.org/node/201981 Blessings, Augustin.
On Dec 18, 2007 8:51 AM, Augustin (Beginner) <drupal.beginner@wechange.org> wrote:
Hello,
On Sunday 16 December 2007 19:54, Augustin (Beginner) wrote:
I was trying to debug a patch for devel_issues.module
I obviously meant project_issues.module.
Thanks everyone for your answers. I am now properly set up.
I have documented everything you told me in the handbook: http://drupal.org/node/201981
Piermaria's notes allowed me to configure and start postfix, but after that, I still was confused about where to find the mails. (I tried with the command mail in the console...)
I finally used chx's method, since it's the second one I tried and it worked. I had to install the package php-cli, though. It will be useful!
A related module is reroute email. It intercepts all outgoing emails and reroutes them to an address you specify. This is very useful in development when you have a copy of a live site with thousands of users, and modules that send email (e.g. subscriptions). http://drupal.org/project/reroute_email
So thanks again!
If you want to add anything else, you may as well add it to the handbook directly: http://drupal.org/node/201981
I will add it there too.
Blessings,
Augustin.
-- Khalid M. Baheyeldin 2bits.com http://2bits.com Drupal optimization, development, customization and consulting.
participants (6)
-
Augustin (Beginner) -
Gábor Hojtsy -
Karoly Negyesi -
Khalid Baheyeldin -
Moshe Weitzman -
Piermaria Maraziti