Sendmail and ISPmanager

From ISPWiki

Jump to: navigation, search

Contents

General information about Sendmail

Sendmail directory:

/etc/mail

Main files:

<hostname>.mc (or sendmail.mc on Linux) - the main configuration file, where all the changes are specified. sendmail.cf is based on that configuration file.

aliases - a list of virtual mailboxes that are expanded to other users. It enables you to redirect your email from a mailbox to a certain user.

virtusertable - maps mail addresses for virtual domains and mailboxes to real mailboxes.

Logs:

/var/log/maillog

Creating e-mail domains via ISPmanager

The information about an e-mail domain is specified in the /etc/mail/virtusertable file

The file may vary depending on the "Default actions" field. :

@company.me error:nouser No such user here - error message
@company.me devnull - ignore and drop
@company.me me@gmail.com - redirect to me@gmail.com 
@company.me %1@me.ispvds.com - redirect to the domain me.ispvds.com 

The local-host-names file contains a list of domain names Sendmail is to accept as the local host name. This means that this local mailbox will be receiving email there regardless mx records of the domain.

Creating mailboxes via ISPmanager

A virtual user (virtuser_id) will be created while creating a mailbos.

The virtusertable file maps mail addresses for virtual domains and mailboxes to real user mailboxes:

sales@company.me virtuser_1005 

In the above example, the virtuser_1005 user maps to the sales@company.me mailbox .

Sendmail stores mailbox passwords in the sasldb database.

The passwords are set by the following command (you can also change the mailbox password by exсecuting this command):

/usr/local/sbin/saslpasswd2 -p -a Sendmail -c -u company.me sales 

The command that is used to set mailbox passwords is specified in the ISPmanager configuration file. It will look like that (the path to sasldb and the db4_dump command may vary depending on your OS):

path db4 db4_dump185 -p /usr/local/etc/sasldb2.db 

The mail alias is specified in the virtusertable file

staff@company.me sales@company.me - staff@company.me is the alias for sales@company.me 

Mail redirects are specified in the aliases file. For example, if you enter gmail@mail.com in the "Send copies to e-mail", aliases will look like this:

virtuser_1005: \virtuser_1005,gmail@mail.com

Auto-responder

In <domain directory>/mail/ is create .vacation.db and .vacation.msg

virtuser associated with the auto-responder should be specified in aliases.

virtuser_1004:  \virtuser_1004,"|vacation -U -f /home/eff/data/email/mary.com/mail/.vacation.db -m /home/eff/data/email/mary.com/mail/.vacation.msg -R mail@mary.com  mail"

Calculating mailbox quota

Sendmail uses virtual users. You should specify the owner - virtuser for the mailbox home directory. In the above example, the virtuser_1005 user maps the sales@company.me mailbox, thus the mailbox home directory and all the files/directories that are kept there has the virtuser_1005 owner.

drwxr-x--x 3 virtuser_1005 fly 512 Dec 3 06:13 /home/fly/data/email/company.me/sales/ 

The quota is set for the virtuser_1005 user. This is a system user that's why the OS will not allow email messages if the user exceeds his quota.

How to transfer an email domain between user accounts

Transfer the company.ru (mary@company.ru) email domain from mary to cat

Sendmail uses virtual users (virtuser). In the /etc/mail/virtusertable file locate the virtuser who is the owner of that mailbox.

mary@company.ru  virtuser_503

In /etc/passwd change the home directory of virtuser_503 from /var/www/mary/data/email/company.ru/mary into /var/www/cat/data/email/company.ru/mary

virtuser_503:x:503:502::/var/www/cat/data/email/company.ru/mary:/usr/sbin/nologin

In the dovecot configuration file (/etc/dovecot/dovecot.passwd) change the mailbox's directory.

Transfer the directory to your new user.

mv /var/www/mary/data/email/company.ru/mary/ /var/www/cat/data/email/company.ru/mary/

As virtuser_503 is the owner of the home directory, you should only change the group into that of your new user

chgrp -R cat /var/www/cat/data/email/company.ru/mary

In the ISPmanager configuration file (/usr/local/ispmgr/etc/ispmgr.conf) locate Domain company.ru 500 and specify the UID of your new user.

Restart ISPmanager

killall ispmgr

Restart dovecot

/etc/init.d/dovecot restart

FAQ

Q: The mailbox stopped functioning upon disabling and enabling.

A: The possible cause of this issue is invalid command for the password damp in the sasldb database in the ISPmanager configuration file.

Q: Email messages are sent to a local email rather than according to the mx records of the domain.

A: Sendmail considers a domain to be local, if:

1. The domain coincides with the server hostname. 2. This email domain is created on the server (the domain is specified in the local-host-names and virtusertable files). 3. The domain coincides with the reverse address of the IP address the email messages is sent from.

Q: Which storage format does sendmail use: maildir or mbox?

A: Sendmail does not support maildir. sendmail can manager maildir through the LDA. You can find the LDA that sendmail is using in the configuration file (if the LDA is not used, email messages are stored in the mbox file). In our example we use procmail: MAILER(procmail)dnl

The format is specified in the procmail configuration file /usr/local/etc/procmailrc (or/etc/procmailrc on Linux).

Was this helpful? Yes | No
Views
Personal tools