qmail

force qmail to process mail queue

Use qmail-qstat or qmail-qread to check the messages in queue.

Run qmail-tcpok to clear out the TCP timeout table.

After that, send the "ALRM " signal to the "qmail-send" process, and Qmail will process all messages in the queue immediately:

kill -ALRM `ps ax | grep [q]mail-send | awk '{print $1}'`

Plesk email users and passwords

Below is sql, if you ever need to test out your users email accounts on plesk server:

mysql> use psa
mysql> select concat(mail_name,"@",name) as email_address, accounts.password from mail left join domains on domains.id=mail.dom_id left join accounts on accounts.id=mail.account_id;

drweb antivirus update cron output

A cron is run every 30 minutes to check on virus database updates via /etc/cron.d/drweb-update, which cause a slew of emails addressed to drweb and filling up mail queue, since drweb does not have a maildir.

To resolve, direct the output to /dev/null or to a log file instead... if you need to keep a watch on the updates.

Edit /etc/cron.d/drweb-update redirecting the output to a log file:

*/30 * * * * drweb /opt/drweb/update.pl >>/tmp/drweb_update.log

If you still want to deliver the output, this can be done by directing drweb mail to root via "/var/drweb/.qmail" or "/var/qmail/alias/.qmail-drweb" with "&root".

cannot create temporary file - (13) Permission denied

This is dues to bug in the default installation of qmail in handling local mails... such as mails to root@localhost where the qmail-local binary is not set with the right owner and permissions, as such mails are not able to be written to the spool located at "/usr/local/psa/handlers/spool".

The error in "/usr/local/psa/var/log/maillog" looks like below:

qmail-local-handlers[......]: cannot create temporary file - (13) Permission denied

To resolve, change the owner and permission of /var/qmail/bin/qmail-local to reflect the same as qmail-remote.

cd /var/qmail/bin
chown mhandlers-user:popuser qmail-local
chmod g+s,g-r,o-r qmail-local

Restart qmail:

/etc/init.d/qmail restart

Plesk root email delivery

To receive local root email to an externally monitored email address:

  • Login to plesk control panel and set the admin contact email address for the server which should update "/var/qmail/alias/.qmail-root" file and add an alias for root.
  • Either add the hostname (FQDN) to the qmail control locals file or to the virtualdomains file located in "/var/qmail/control/".
  • Also add the hostname (FQDN) to the "/var/qmail/control/rcpthosts" file if not already present so local mails get delivered.
  • Restart inetd and qmail:
    /etc/init.d/inetd restart
    /etc/init.d/qmail restart
  • Check with:
    /var/qmail/bin/qmail-showctl

    This should show:

    ...
    locals:
    ...
    Messages for host.domain.tl are delivered locally.
    ...
    rcpthosts:
    ...
    SMTP clients may send messages to recipients at host.domain.tld.
    ...

Issues with receiving mail on Plesk server

I was not receiving mails from a particular email address. The MX records checked out fine. The mail server was not in any of the DNSBL list I was subscribed to. There was nothing in the logs that mentioned that there was any emails coming in from the user. However, it did have a lot of relaylocks for the mail servers IP address.

Digging in some more, I found a similar issue discussed at theplanet forum where the issue was caused due to conflict of timeouts and auth packets being dropped instead by the sender mail server, so I adjusted qmail timeout which seemed to push the conversation between the MTAs forward and the emails are now being accepted.

I changed the default timeout from 30 seconds to 15 seconds by editing the /etc/inetd and adding -t15 as below.

smtp stream tcp nowait.1000 root /var/qmail/bin/tcp-env tcp-env -t15 /usr/sbin/rblsmtpd  -r bl.spamcop.net -r zen.spamhaus.org /var/qmail/bin/relaylock /var/qmail/bin/qmail-smtpd /var/qmail/bin/smtp_auth /var/qmail/bin/true /var/qmail/bin/cmd5checkpw /var/qmail/bin/true
smtps stream tcp nowait.1000 root /var/qmail/bin/tcp-env tcp-env -t15 /usr/sbin/rblsmtpd  -r bl.spamcop.net -r zen.spamhaus.org /var/qmail/bin/relaylock /var/qmail/bin/qmail-smtpd /var/qmail/bin/smtp_auth /var/qmail/bin/true /var/qmail/bin/cmd5checkpw /var/qmail/bin/true

Piping all mail to file in plesk 8.2

  1. Edit "/var/qmail/mailnames/{domain.tld}/.qmail-default"
  2. Remove any lines in the file and add the pipe to file:
    | /var/www/vhosts/{domain.tld}/file.php
  3. Change the file permission to be executable and owned by the correct user/group of the site, specially if you are executing under safe_mode.
    $ chmod 755 /var/www/vhosts/{domain.tld}/file.php
  4. Check to make sure that "/var/qmail/control/rejectnonexist" does not have the corresponding domain listed there.
  5. Restart qmail.
Comment