Enable POP3 mail server service on IPStor Server

This document for description how to enable email server on OEL/CentOS 5.X operating system. Follow the steps can easy setup email server successfully.


Install new package:
$yum install  cyrus-imapd.x86_64


Edit:
$vi /etc/mail/sendmail.cf #remove RED parts.

dnl define(`confLOCAL_MAILER', `cyrusv2')dnl
dnl define(`CYRUSV2_MAILER_ARGS', `FILE /var/lib/imap/socket/lmtp')dnl
​…..

dnl MAILER(cyrusv2)dnl​
​to
define(`confLOCAL_MAILER', `cyrusv2')dnl
define(`CYRUSV2_MAILER_ARGS', `FILE /var/lib/imap/socket/lmtp')dnl

….
MAILER(cyrusv2)dnl​


Update Sendmail configuration:
$cd /etc/mail/
$m4 sendmail.mc > sendmail.cf
$service sendmail restart # which command will prompt some warring messages:
[root@IPStorTeamStorage mail]# service sendmail restart
Shutting down sm-client:                                   [FAILED]
Shutting down sendmail:                                    [FAILED]
Starting sendmail: /etc/mail/sendmail.cf: WARNING: dangerous write permissions
451 4.0.0 /etc/mail/sendmail.cf: line 91: fileclass: cannot open '/etc/mail/local-host-names': Group writable directory
451 4.0.0 /etc/mail/sendmail.cf: line 588: fileclass: cannot open '/etc/mail/trusted-users': Group writable directory
                                                           [FAILED]
Starting sm-client: /etc/mail/submit.cf: line 544: fileclass: cannot open '/etc/mail/trusted-users': Group writable directory
                                                           [FAILED]

Resolve method:
$cd / ; chmod 0755 etc
$cd /etc ; chmod 0644 mail
$cd mail ; chmod 0644 *


Enable and Start Services:
$service sendmail restart
$chkconfig cyrus-imapd on
$chkconfig saslauthd on
$service saslauthd start
$service  cyrus-imapd start


Add email user account:
$cyradm –user cyrus localhost
localhost.localdomain> cm user.newmailuser # newmailuser is you define user account
quit
$saslpasswd2 -c newmailuser # type password for email account.


Verificaton:
Send a test email by script:
mail -s "This email send from IPStorTeamStorage server!" newmailuser@localhost
<< EOF
Test IPStorTeamStorage send's email
….
bye bye
EOF

I like use mutt as local email client which can help to verify the setting for email server.
$yum install mutt
$sunewmailuser
$cp /usr/share/doc/mutt-1.4.2.2/sample.muttrc ~/.muttrc
$vi .muttrc
set use_mailcap=yes # delete
source ~/.muttrc-local #delete
#set spoolfile='~/mailbox #add mark
set spoolfile='imap://localhost/INBOX' #new add
$mutt 
Username at localhost: newmailuser
Password for newmailuser@localhost:​


In email client side account setting:
Email Server type: POP3
Email Server Name: your IPStor server name(DNS) or IP  and Port: 110
Email account: newmailuser
Connect security: STARTTLS
Authorized: Normal Password


Deleting a Mailbox

To delete a mailbox, you must fix give the admin user 'create' permissions on the mailbox. To the surprise of many, the admin does not have this permission by default. Then you can delete the mailbox with 'dm'.

localhost> lam user.test
test lrswipcda
localhost.localdomain> dm user.test
deletemailbox: Permission denied
localhost> sam user.test cyrus c 
localhost> lam user.test
test lrswipcda
cyrus c
localhost> dm user.test

Finally, I didn't setup the IPStor server as email can reply or send out email for security reason.