HowtoForge Forums | HowtoForge - Linux Howtos and Tutorials

HowtoForge Forums | HowtoForge - Linux Howtos and Tutorials (http://www.howtoforge.com/forums/index.php)
-   HOWTO-Related Questions (http://www.howtoforge.com/forums/forumdisplay.php?f=2)
-   -   Drupal + Postfix Integration (http://www.howtoforge.com/forums/showthread.php?t=42513)

handheld 9th January 2010 08:18

Drupal + Postfix Integration
 
Hello,
I got halfway through Drupal + Postfix Integration and thought it may not be for me because it started instructing me on how to set up e-mail accounts for Drupal users. Anyway, what I'm trying to do is enable the e-mail for Drupal registrations and reseting passwords, but my test user is still not getting a password reset e-mail. I'm going through the Postfix Debugging Howto, now, but if anyone has any suggestions, please help.
Thanks

falko 10th January 2010 17:29

Are there any errors in your mail log?

handheld 10th January 2010 20:17

Let's see. I think I was looking in the wrong place for errors the other night, but yeah, I have some errors; and I don't see how to fix them because it says
Code:

postfix/trivial-rewrite[3064]: warning: do not list domain [my.domain.url] in BOTH mydestination and virtual_mailbox_domains
but the latter doesn't list the domain like the former. The latter says,
Code:

virtual_mailbox_domains = proxy:mysql:/etc/postfix/drupal-domains.cf
and drupal-domains.cf says, per the instructions:
Code:

user = [username]
password = [password]
dbname = [dbname]
query = SELECT domain_name AS domain FROM mailfix_domains
  WHERE domain_name = '%s'
hosts = 127.0.0.1

mydestination is set to
Code:

mydestination = [my.domain.url], localhost, localhost.[mylocal.domain]
More errors:
Code:

postfix/trivial-rewrite[3079]: warning: do not list domain [my.domain.url] in BOTH mydestination and virtual_mailbox_domains
postfix/master[2995]: warning: process /usr/lib/postfix/smtp pid 3204 killed by signal 15
postfix/qmgr[3213]: warning: connect to transport smtp: Connection refused
postfix/qmgr[2596]: warning: connect to transport smtp: Connection refused

Here's my master.cf:
Code:

2525      inet  n      -      n      -      -      smtpd
#listens to port 2525 since ISP blocks 25
pickup    fifo  n      -      -      60      1      pickup
 25 cleanup  unix  n      -      -      -      0      cleanup
 26 qmgr      fifo  n      -      n      300    1      qmgr
 27 #qmgr    fifo  n      -      -      300    1      oqmgr
 28 tlsmgr    unix  -      -      -      1000?  1      tlsmgr
 29 rewrite  unix  -      -      -      -      -      trivial-rewrite
 30 bounce    unix  -      -      -      -      0      bounce
 31 defer    unix  -      -      -      -      0      bounce
 32 trace    unix  -      -      -      -      0      bounce
 33 verify    unix  -      -      -      -      1      verify
 34 flush    unix  n      -      -      1000?  0      flush
 35 proxymap  unix  -      -      n      -      -      proxymap
 36 proxywrite unix -      -      n      -      1      proxymap
 37 #smtp      unix  -      -      -      -      -      smtp
 38 2525      unix  -      -      n      -      -      smtp
 39 # When relaying mail as backup MX, disable fallback_relay to avoid MX loops
 40 relay    unix  -      -      -      -      -      smtp
 41        -o smtp_fallback_relay=
 42 #      -o smtp_helo_timeout=5 -o smtp_connect_timeout=5
 43 showq    unix  n      -      -      -      -      showq
 44 error    unix  -      -      -      -      -      error
 45 retry    unix  -      -      -      -      -      error
 46 discard  unix  -      -      -      -      -      discard
 47 local    unix  -      n      n      -      -      local
 48 virtual  unix  -      n      n      -      -      virtual
 49 lmtp      unix  -      -      -      -      -      lmtp
 50 anvil    unix  -      -      -      -      1      anvil
scache    unix  -      -      -      -      1      scache
maildrop  unix  -      n      n      -      -      pipe
 66  flags=DRhu user=vmail argv=/usr/bin/maildrop -d ${recipient}
uucp      unix  -      n      n      -      -      pipe
 71  flags=Fqhu user=uucp argv=uux -r -n -z -a$sender - $nexthop!rmail ($recipient)
ifmail    unix  -      n      n      -      -      pipe
 76  flags=F user=ftn argv=/usr/lib/ifmail/ifmail -r $nexthop ($recipient)
 77 bsmtp    unix  -      n      n      -      -      pipe
 78  flags=Fq. user=bsmtp argv=/usr/lib/bsmtp/bsmtp -t$nexthop -f$sender $recipient
 79 scalemail-backend unix  -      n      n      -      2      pipe
 80  flags=R user=scalemail argv=/usr/lib/scalemail/bin/scalemail-store ${nexthop} ${user} ${extension}
 81 mailman  unix  -      n      n      -      -      pipe
 82  flags=FR user=list argv=/usr/lib/mailman/bin/postfix-to-mailman.py
 83  ${nexthop} ${user}
 84 dovecot  unix  -      n      n      -      -      pipe
 85  flags=DRhu user=vmail:vmail argv=/usr/lib/dovecot/deliver -d ${recipient}

The line numbers are just apart of my .vimrc. Here's my main.cf:
Code:

smtpd_banner = $myhostname ESMTP $mail_name
 10 biff = no
 11
 12 # appending .domain is the MUA's job.
 13 append_dot_mydomain = no
 14
 15 # Uncomment the next line to generate "delayed mail" warnings
 16 #delay_warning_time = 4h
 17
 18 readme_directory = /usr/share/doc/postfix
 19
 20 # TLS parameters
 21 smtpd_tls_cert_file = /etc/postfix/smtpd.cert
 22 smtpd_tls_key_file = /etc/postfix/smtpd.key
 23 smtpd_use_tls = yes
 24 smtpd_tls_session_cache_database = btree:${data_directory}/smtpd_scache
 25 smtp_tls_session_cache_database = btree:${data_directory}/smtp_scache
 26
 27 # See /usr/share/doc/postfix/TLS_README.gz in the postfix-doc package for
 28 # information on enabling SSL in the smtp client.
 29
 30 myhostname = [my.domain.url]
 31 alias_maps = hash:/etc/aliases
 32 alias_database = hash:/etc/aliases
 33 myorigin = /etc/mailname
 34 mydestination = [my.domain.url], localhost, localhost.[mylocal.domain]
 35 relayhost =
 36 mynetworks = 127.0.0.0/8
 37 mailbox_command = procmail -a "$EXTENSION"
 38 mailbox_size_limit = 0
 39 recipient_delimiter = +
 40 inet_interfaces = all
 41 html_directory = /usr/share/doc/postfix/html
 42 virtual_alias_domains =
 43 virtual_alias_maps = proxy:mysql:/etc/postfix/drupal-forward.cf
 44 virtual_mailbox_domains = proxy:mysql:/etc/postfix/drupal-domains.cf
 45 virtual_mailbox_maps = proxy:mysql:/etc/postfix/drupal-mailboxes.cf
 46 virtual_mailbox_base = /home/vmail
 47 virtual_uid_maps = static:5000
 48 virtual_gid_maps = static:5000
 49 smtpd_sasl_auth_enable = yes
 50 broken_sasl_auth_clients = yes
51 smtpd_sasl_authenticated_header = yes
 52 smtpd_sasl_path = private/auth
 53 smtpd_sasl_type = dovecot
 54 smtpd_recipient_restrictions = permit_mynetworks, permit_sasl_authenticated, reject_unauth_destination
 55 virtual_create_maildirsize = yes
 56 virtual_mailbox_extended = yes
 57 virtual_mailbox_limit_maps = proxy:mysql:/etc/postfix/drupal-quota.cf
 58 virtual_mailbox_limit_override = yes
 59 virtual_maildir_limit_message = "The user you are trying to reach is over quota."
 60 virtual_overquota_bounce = yes
 61 recipient_bcc_maps = proxy:mysql:/etc/postfix/drupal-recipient-bcc.cf
 62 sender_bcc_maps = proxy:mysql:/etc/postfix/drupal-sender-bcc.cf
 63 proxy_read_maps = $local_recipient_maps $mydestination $virtual_alias_maps $virtual_alias_domains $virtual_mailbox_maps $virtual_mailbox_domains            $relay_recipient_maps $relay_domains $canonical_maps $sender_canonical_maps $recipient_canonical_maps $relocated_maps $transport_maps $mynetworks          $virtual_mailbox_limit_maps $recipient_bcc_maps $sender_bcc_maps
 64 virtual_transport = dovecot
 65 dovecot_destination_recipient_limit = 1


falko 11th January 2010 14:16

Quote:

Originally Posted by handheld (Post 215727)
Let's see. I think I was looking in the wrong place for errors the other night, but yeah, I have some errors; and I don't see how to fix them because it says
Code:

postfix/trivial-rewrite[3064]: warning: do not list domain [my.domain.url] in BOTH mydestination and virtual_mailbox_domains

This means you have my.domain.url in mydestination and also in the MySQL database. You can have it in only one location, not both. If you want to use that domain for virtual users, please remove it from mydestination and restart Postfix.

asaavedra 11th January 2010 14:55

Mailfix module
 
You're probably right. This module is intended for centralized authentication between Drupal and Postfix. If you just need to send Drupal alerts, it should work out of the box. You may want to monitor the mail log:
Code:

sudo tail -f /var/log/mail/mail.log
If the mail is actually being sent, check the anti-spam folder. If the mail is not being sent, check your Drupal site configuration. The Drupal log will help.

handheld 11th January 2010 20:54

Okay, this is still a little over my head, but I want to hang in there. I could definitely remove the domain name from the main.cf even though I don't understand virtual users. My guess would be anyone who doesn't have an actual user account on my server, i.e. those Drupal users requesting a password or registering.

On the other hand, I monitored the mail.log while requesting a new password, and it showed something interesting:
Quote:

Jan 11 13:57:07 debian postfix/pickup[2592]: 20152F6268: uid=33 from=<www-data>
Jan 11 13:57:07 debian postfix/cleanup[2845]: 20152F6268: message-id=<20100111185707.20152F6268@fingertip-realm.webhop.info>
Jan 11 13:57:07 debian postfix/qmgr[2593]: 20152F6268: from=<www-data@fingertip-realm.webhop.info>, size=1148, nrcpt=1 (queue active)
Jan 11 13:57:07 debian postfix/qmgr[2593]: warning: connect to transport smtp: Connection refused
Jan 11 13:57:07 debian postfix/error[2852]: 20152F6268: to=<my.email@gmail.com>, relay=none, delay=0.31, delays=0.26/0.02/0/0.03, dsn=4.3.0, status=deferred (mail transport unavailable)
I know I left the domain name in there this time because, what, I don't want visitors?? It's just a blank message board though.

Alright, what I did was change the
Quote:

scache unix - - - - 1 scache
to
Quote:

scache unix - - n - 1 scache
and restarted the postfix daemon that's in init.d, but it didn't make a difference until I put case-sensitive letters in the captcha. Never can tell with those captchas unless they're explicit. This one, Mollum, was telling me an e-mail was sent no matter what I put in there. The difference was it left out the line about refused smtp connection, but four minutes later, it spouted all those original four lines out again. Then, I took out the domain name from main.cf and restarted the postfix daemon again, but same errors; so I'm reverting back both files. I also rebooted after making the changes, but that didn't work.

PS Should the myhostname be my server's hostname or the web domain name?

asaavedra 11th January 2010 21:21

Postfix configuration
 
Handheld,

It seems to be a Postfix issue. I don't think you need Mailfix domain to accomplish what you want (send Drupal alerts), so you probably don't need virtual hosts at all. It seems like you want your Drupal server to send out mail messages directly. Thus your Postfix configuration should have mydestination directive include localhost. To verify this:
Code:

sudo postconf | grep mydestination
Check if localhost is included in this directive (my guess is it isn't). In case it's not, just reconfigure:
Code:

sudo postconf -e "mydestination = you.host.here, localhost, localhost.localdomain"
Then your messages should be sent as expected. HTH

handheld 11th January 2010 22:10

hmm, mydestination already says localhost :-/
Quote:

mydestination = fingertip-realm.webhop.info, localhost, localhost.fingertip-realm.local
proxy_read_maps = $local_recipient_maps $mydestination $virtual_alias_maps $virtual_alias_domains $virtual_mailbox_maps $virtual_mailbox_domains $relay_recipient_maps $relay_domains $canonical_maps $sender_canonical_maps $recipient_canonical_maps $relocated_maps $transport_maps $mynetworks $virtual_mailbox_limit_maps $recipient_bcc_maps $sender_bcc_maps
relay_domains = $mydestination
I could uninstall Mailfix. I uncommented the smtp unix line, and the trial timed out; so I found out to set up a relayhost; but my ISP doesn't allow home servers; so I guess I better switch ISPs.

asaavedra 11th January 2010 22:27

Drupal SMTP modules
 
You may also want to try SMTP Drupal modules. PHPMailer is an excellent module for remote SMTP authentication, you may use a Gmail account, for instance.

handheld 11th January 2010 23:16

thanks a lot :) It threw an error
Quote:

Fatal error: Call to undefined function drupal_mail_wrapper() in /var/www/html/drupal-6.15/includes/mail.inc on line 177
which I don't understand:
Quote:

177 return drupal_mail_wrapper($message);
but it sent the password reset e-mail!! :) thanks again


All times are GMT +2. The time now is 11:03.

Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2014, vBulletin Solutions, Inc.