Cant get Email working... Tried many times with many different how to's.

Hey everyone!

Okay. My problem is that I have re-installed Debian 7 x64 and installed virtualmin and configured everything many times just to try to get the email to work. From my understanding, with virtualmin on a grade A system you should be able to install and go… But that is not the case for emails at least within debian install.

I would also like to address someone who said it was easier to configure Postfix than sendmail. Well it is not, because sendmail works without any user intervention and Postfix needs configuring and crap. That and I have tried configuring it many times without success.

Before logs/configuration crap, I would like to say that the MX records are set and fine, and the reverse ptr has been set up so I should be able to send to at least a hotmail junk box…

My Configuration:

root@snapchatdb:~# uname -a
Linux ns1.snapchatdb.net 3.2.0-4-amd64 #1 SMP Debian 3.2.46-1+deb7u1 x86_64 GNU/Linux

My Logs:

I think this is the problem (cat /var/log/mail.err)root@snapchatdb:~# cat /var/log/mail.err
Jan 22 06:15:02 snapchatdb dovecot: imap(test.snapchatdb): Error: Opening INBOX failed: Mailbox doesn’t exist: INBOX
Jan 22 06:15:02 snapchatdb dovecot: imap(test.snapchatdb): Error: open(/var/mail/test.snapchatdb) failed: Permission denied (euid=1002(test.snapchatdb) egid=1000(snapchatdb) missing +w perm: /var/mail, we’re not in group 8(mail), dir owned by 0:8 mode=0775)
Jan 22 06:15:02 snapchatdb dovecot: imap(test.snapchatdb): Error: open(/var/mail/test.snapchatdb) failed: Permission denied (euid=1002(test.snapchatdb) egid=1000(snapchatdb) missing +w perm: /var/mail, we’re not in group 8(mail), dir owned by 0:8 mode=0775)
Jan 22 06:15:02 snapchatdb dovecot: imap(test.snapchatdb): Error: Opening INBOX failed: Mailbox doesn’t exist: INBOX
Jan 22 06:15:02 snapchatdb dovecot: imap(test.snapchatdb): Error: open(/var/mail/test.snapchatdb) failed: Permission denied (euid=1002(test.snapchatdb) egid=1000(snapchatdb) missing +w perm: /var/mail, we’re not in group 8(mail), dir owned by 0:8 mode=0775)
Jan 22 06:15:02 snapchatdb dovecot: imap(test.snapchatdb): Error: open(/var/mail/test.snapchatdb) failed: Permission denied (euid=1002(test.snapchatdb) egid=1000(snapchatdb) missing +w perm: /var/mail, we’re not in group 8(mail), dir owned by 0:8 mode=0775)

my mail.log (cat /var/log/mail.log) an 23 02:34:22 snapchatdb postfix/smtpd[3280]: connect from localhost.localdomain[127.0.0.1]
Jan 23 02:34:22 snapchatdb postfix/smtpd[3280]: 9F6C218A234: client=localhost.localdomain[127.0.0.1]
Jan 23 02:34:22 snapchatdb postfix/cleanup[3284]: 9F6C218A234: message-id=1755f1f7c93b5ed857fb8eef4494c5f3.squirrel@snapchatdb.net
Jan 23 02:34:22 snapchatdb postfix/qmgr[3115]: 9F6C218A234: from=test.snapchatdb@snapchatdb.net, size=830, nrcpt=1 (queue active)
Jan 23 02:34:22 snapchatdb postfix/smtpd[3280]: disconnect from localhost.localdomain[127.0.0.1]
Jan 23 02:34:22 snapchatdb dovecot: imap-login: Login: user=<test.snapchatdb>, method=PLAIN, rip=127.0.0.1, lip=127.0.0.1, mpid=3287, secured, session=<VNxHFJrwTAB/AAAB>
Jan 23 02:34:22 snapchatdb dovecot: imap(test.snapchatdb): Disconnected: Logged out in=705 out=471
Jan 23 02:34:22 snapchatdb dovecot: imap-login: Login: user=<test.snapchatdb>, method=PLAIN, rip=127.0.0.1, lip=127.0.0.1, mpid=3289, secured, session=<So1KFJrwTQB/AAAB>
Jan 23 02:34:22 snapchatdb dovecot: imap(test.snapchatdb): Disconnected: Logged out in=117 out=1440
Jan 23 02:34:24 snapchatdb postfix/smtp[3285]: 9F6C218A234: to=shawnread@hotmail.ca, relay=mx3.hotmail.com[65.55.37.104]:25, delay=2, delays=0.06/0.02/1/0.87, dsn=2.0.0, status=sent (250 1755f1f7c93b5ed857fb8eef4494c5f3.squirrel@snapchatdb.net Queued mail for delivery)
Jan 23 02:34:24 snapchatdb postfix/qmgr[3115]: 9F6C218A234: removed
Jan 23 02:40:03 snapchatdb postfix/pickup[3114]: ACF1918A235: uid=33 from=
Jan 23 02:40:03 snapchatdb postfix/cleanup[3558]: ACF1918A235: message-id=20140123024003.ACF1918A235@snapchatdb.net
Jan 23 02:40:03 snapchatdb postfix/qmgr[3115]: ACF1918A235: from=www-data@snapchatdb.net, size=3574, nrcpt=1 (queue active)
Jan 23 02:40:03 snapchatdb postfix/error[3560]: ACF1918A235: to=root@snapchatdb.net, orig_to=, relay=none, delay=0.26, delays=0.1/0.03/0/0.14, dsn=5.0.0, status=bounced (User unknown in virtual alias table)
Jan 23 02:40:03 snapchatdb postfix/cleanup[3558]: E9B9418A238: message-id=20140123024003.E9B9418A238@snapchatdb.net
Jan 23 02:40:03 snapchatdb postfix/qmgr[3115]: E9B9418A238: from=<>, size=5386, nrcpt=1 (queue active)
Jan 23 02:40:03 snapchatdb postfix/bounce[3561]: ACF1918A235: sender non-delivery notification: E9B9418A238
Jan 23 02:40:03 snapchatdb postfix/qmgr[3115]: ACF1918A235: removed
Jan 23 02:40:03 snapchatdb postfix/error[3560]: E9B9418A238: to=www-data@snapchatdb.net, relay=none, delay=0.02, delays=0.01/0/0/0.01, dsn=5.0.0, status=bounced (User unknown in virtual alias table)
Jan 23 02:40:03 snapchatdb postfix/qmgr[3115]: E9B9418A238: removed
Jan 23 02:44:01 snapchatdb dovecot: config: Warning: NOTE: You can get a new clean config file with: doveconf -n > dovecot-new.conf
Jan 23 02:44:01 snapchatdb dovecot: config: Warning: Obsolete setting in /usr/share/dovecot/protocols.d/imapd.protocol:1: ‘imaps’ protocol is no longer necessary, remove it
Jan 23 02:44:01 snapchatdb dovecot: config: Warning: Obsolete setting in /usr/share/dovecot/protocols.d/imapd.protocol:1: ‘pop3s’ protocol is no longer necessary, remove it

and my mail.warn (cat /var/log/mail.warn Jan 23 02:10:04 snapchatdb postfix/trivial-rewrite[1975]: warning: do not list domain snapchatdb.net in BOTH mydestination and virtual_alias_domains
Jan 23 02:20:04 snapchatdb postfix/trivial-rewrite[2452]: warning: do not list domain snapchatdb.net in BOTH mydestination and virtual_alias_domains
Jan 23 02:30:04 snapchatdb postfix/trivial-rewrite[2843]: warning: do not list domain snapchatdb.net in BOTH mydestination and virtual_alias_domains
Jan 23 02:33:10 snapchatdb dovecot: config: Warning: NOTE: You can get a new clean config file with: doveconf -n > dovecot-new.conf
Jan 23 02:33:10 snapchatdb dovecot: config: Warning: Obsolete setting in /usr/share/dovecot/protocols.d/imapd.protocol:1: ‘imaps’ protocol is no longer necessary, remove it
Jan 23 02:33:10 snapchatdb dovecot: config: Warning: Obsolete setting in /usr/share/dovecot/protocols.d/imapd.protocol:1: ‘pop3s’ protocol is no longer necessary, remove it
Jan 23 02:44:01 snapchatdb dovecot: config: Warning: NOTE: You can get a new clean config file with: doveconf -n > dovecot-new.conf
Jan 23 02:44:01 snapchatdb dovecot: config: Warning: Obsolete setting in /usr/share/dovecot/protocols.d/imapd.protocol:1: ‘imaps’ protocol is no longer necessary, remove it
Jan 23 02:44:01 snapchatdb dovecot: config: Warning: Obsolete setting in /usr/share/dovecot/protocols.d/imapd.protocol:1: ‘pop3s’ protocol is no longer necessary, remove it

my mail.info (cat /var/log/mail.info) Jan 23 02:50:03 snapchatdb postfix/pickup[3114]: E5F7818A237: uid=33 from=
Jan 23 02:50:03 snapchatdb postfix/cleanup[3928]: E5F7818A237: message-id=20140123025003.E5F7818A237@snapchatdb.net
Jan 23 02:50:03 snapchatdb postfix/qmgr[3115]: E5F7818A237: from=www-data@snapchatdb.net, size=3574, nrcpt=1 (queue active)
Jan 23 02:50:03 snapchatdb postfix/error[3930]: E5F7818A237: to=root@snapchatdb.net, orig_to=, relay=none, delay=0.06, delays=0.04/0.01/0/0.01, dsn=5.0.0, status=bounced (User unknown in virtual alias table)
Jan 23 02:50:03 snapchatdb postfix/cleanup[3928]: EF50B18A238: message-id=20140123025003.EF50B18A238@snapchatdb.net
Jan 23 02:50:03 snapchatdb postfix/qmgr[3115]: EF50B18A238: from=<>, size=5386, nrcpt=1 (queue active)
Jan 23 02:50:03 snapchatdb postfix/bounce[3931]: E5F7818A237: sender non-delivery notification: EF50B18A238
Jan 23 02:50:03 snapchatdb postfix/qmgr[3115]: E5F7818A237: removed
Jan 23 02:50:03 snapchatdb postfix/error[3930]: EF50B18A238: to=www-data@snapchatdb.net, relay=none, delay=0.01, delays=0/0/0/0, dsn=5.0.0, status=bounced (User unknown in virtual alias table)
Jan 23 02:50:03 snapchatdb postfix/qmgr[3115]: EF50B18A238: removed
Jan 23 02:54:01 snapchatdb dovecot: imap-login: Login: user=<test.snapchatdb>, method=PLAIN, rip=127.0.0.1, lip=127.0.0.1, mpid=4064, secured, session=<s8OGWprwUAB/AAAB>
Jan 23 02:54:01 snapchatdb dovecot: imap(test.snapchatdb): Disconnected: Logged out in=79 out=704

My main.cf

root@snapchatdb:~# cat /etc/postfix/main.cf

See /usr/share/postfix/main.cf.dist for a commented, more complete version

Debian specific: Specifying a file name will cause the first

line of that file to be used as the name. The Debian default

is /etc/mailname.

#myorigin = /etc/mailname

smtpd_banner = $myhostname ESMTP $mail_name (Debian/GNU)
biff = no

appending .domain is the MUA’s job.

append_dot_mydomain = no

Uncomment the next line to generate “delayed mail” warnings

#delay_warning_time = 4h

readme_directory = no

TLS parameters

smtpd_tls_cert_file=/etc/ssl/certs/ssl-cert-snakeoil.pem
smtpd_tls_key_file=/etc/ssl/private/ssl-cert-snakeoil.key
smtpd_use_tls=yes
smtpd_tls_session_cache_database = btree:${data_directory}/smtpd_scache
smtp_tls_session_cache_database = btree:${data_directory}/smtp_scache

See /usr/share/doc/postfix/TLS_README.gz in the postfix-doc package for

information on enabling SSL in the smtp client.

myhostname = snapchatdb.net
alias_maps = hash:/etc/aliases
alias_database = hash:/etc/aliases
myorigin = /etc/mailname

mydestination = localhost
#mydestination = snapchatdb.net, localhost, localhost.localdomain, localhost, ns1.snapchatdb.net

mynetworks = 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128
mailbox_size_limit = 0
recipient_delimiter = +

virtual_alias_maps = hash:/etc/postfix/virtual

sender_bcc_maps = hash:/etc/postfix/bcc
mailbox_command = /usr/bin/procmail-wrapper -o -a $DOMAIN -d $LOGNAME
home_mailbox = Maildir/
smtpd_sasl_auth_enable = yes
smtpd_sasl_security_options = noanonymous
broken_sasl_auth_clients = yes
smtpd_recipient_restrictions = permit_mynetworks permit_sasl_authenticated reject_unauth_destination
allow_percent_hack = no

Summary of problems:

  • Cannot send email to hotmail (not even junk dir) -- yes my reverse ptr is set
  • Cannot receive / see the mail in the inbox
  • I have a feeling mail is not routing to the correct inboxes

Anyone have any ideas? I am lost :frowning:

Any and all help is much appreciated!

Thanks!

Howdy,

Sorry that you’re having trouble getting your install to work.

Are you using a VPS, or a dedicated server?

It really should be simplest to use Postfix. And that should indeed work on a new install. I haven’t actually seen the errors you’re receiving on a new install before though, that’s unusual!

It actually sounds like there may be a Dovecot configuration problem.

It looks like Dovecot may be looking in the wrong place for email.

Can you paste in the output of the command dovecot -n?

-Eric

YEah thanks :stuck_out_tongue: Not really your fault though. Thanks for responding.

Yes, I am using a VPS. Is this why its not working properly? I didn’t think being a VPS mattered… I mean I know it did with CPanel, but Virtualmin is different. I know CPanel had a separate version to install on a VPS.

I don’t see how modifying configs is simpler than just installing debian and using default sendmail without modding configs or installing anything…

Well, if dovecot was the problem, I would still be able to send an email, wouldn’t I? I figure the emails not showing in the inbox is a dovecot config problem, while the emails not being sent or reaching their destination is a postfix problem. All that based off knowing Dovecot is IMAP/Pop3 server (for retrieving mail) and postfix is a mail transport agent, which sends/receives/delivers messages to their destination.

Regardless I need to fix both problems (dovecot looking wrong maildir, and postfix not sending emails)

dovecot -n:
root@snapchatdb:~# dovecot -n

2.1.7: /etc/dovecot/dovecot.conf

doveconf: Warning: NOTE: You can get a new clean config file with: doveconf -n > dovecot-new.conf
doveconf: Warning: Obsolete setting in /usr/share/dovecot/protocols.d/imapd.protocol:1: ‘imaps’ protocol is no longer necessary, remove it
doveconf: Warning: Obsolete setting in /usr/share/dovecot/protocols.d/imapd.protocol:1: ‘pop3s’ protocol is no longer necessary, remove it

OS: Linux 3.2.0-4-amd64 x86_64 Debian 7.3

disable_plaintext_auth = no
mail_location = maildir:~/Maildir
namespace inbox {
inbox = yes
location =
mailbox Drafts {
special_use = \Drafts
}
mailbox Junk {
special_use = \Junk
}
mailbox Sent {
special_use = \Sent
}
mailbox “Sent Messages” {
special_use = \Sent
}
mailbox Trash {
special_use = \Trash
}
prefix =
}
passdb {
driver = pam
}
plugin {
sieve = ~/.dovecot.sieve
sieve_dir = ~/sieve
}
protocols = imap pop3 pop3
ssl_cert = </etc/dovecot/dovecot.pem
ssl_key = </etc/dovecot/private/dovecot.pem
userdb {
driver = passwd
}
protocol pop3 {
pop3_uidl_format = %08Xu%08Xv
}

Thank You again for responding :slight_smile:

Howdy,

Well, the reason I asked about if it’s a VPS is that Debian usually works really well.

However, we’ve seen occasional issues where a VPS provider might make subtle changes to how this or that package works, which can cause things to work (or not work) in an unexpected way.

This isn’t to say that the VPS provider’s changes are bad in any way, but the Virtualmin installer could get thrown off by certain changes.

I don’t actually see anything wrong with your Dovecot config though.

Could you paste in the contents of your /etc/procmailrc file, as well as the output of the command “postconf -n”?

-Eric

procmailrc:
root@snapchatdb:~# cat /etc/procmailrc
:0wi
VIRTUALMIN=|/etc/webmin/virtual-server/lookup-domain.pl $LOGNAME
EXITCODE=$?
:0

  • ?/usr/bin/test “$EXITCODE” = “73”
    /dev/null
    EXITCODE=0
    :0
  • ?/usr/bin/test “$VIRTUALMIN” != “”
    {
    INCLUDERC=/etc/webmin/virtual-server/procmail/$VIRTUALMIN
    }
    DEFAULT=$HOME/Maildir/
    ORGMAIL=$HOME/Maildir/
    DROPPRIVS=yes
    :0
    $DEFAULT

postconf -n:
root@snapchatdb:~# postconf -n
alias_database = hash:/etc/aliases
alias_maps = hash:/etc/aliases
allow_percent_hack = no
append_dot_mydomain = no
biff = no
broken_sasl_auth_clients = yes
config_directory = /etc/postfix
home_mailbox = Maildir/
mailbox_command = /usr/bin/procmail-wrapper -o -a $DOMAIN -d $LOGNAME
mailbox_size_limit = 0
mydestination = localhost
myhostname = snapchatdb.net
mynetworks = 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128
myorigin = /etc/mailname
readme_directory = no
recipient_delimiter = +
sender_bcc_maps = hash:/etc/postfix/bcc
smtp_tls_session_cache_database = btree:${data_directory}/smtp_scache
smtpd_banner = $myhostname ESMTP $mail_name (Debian/GNU)
smtpd_recipient_restrictions = permit_mynetworks permit_sasl_authenticated reject_unauth_destination
smtpd_sasl_auth_enable = yes
smtpd_sasl_security_options = noanonymous
smtpd_tls_cert_file = /etc/ssl/certs/ssl-cert-snakeoil.pem
smtpd_tls_key_file = /etc/ssl/private/ssl-cert-snakeoil.key
smtpd_tls_session_cache_database = btree:${data_directory}/smtpd_scache
smtpd_use_tls = yes
virtual_alias_maps = hash:/etc/postfix/virtual

Sources.lst
root@snapchatdb:~# cat /etc/apt/sources.list
deb http://ftp.us.debian.org/debian wheezy main
deb http://security.debian.org/ wheezy/updates main

#deb http://repo.r1soft.com/apt stable main ###Possibly the WebHost’s custom repo
deb http://software.virtualmin.com/gpl/debian/ virtualmin-wheezy main
deb http://software.virtualmin.com/gpl/debian/ virtualmin-universal main

Is there a way to compare and see if and what they did change in the distro? Could it be custom repos or would it still use debian repos? According to the sources.lst I am only using virtualmin and debian repos… The only other repo is the one I commented out, possibly being the webhost’s custom repo (it doesn’t match the name of my webhost)

I think there’s a problem in my main.cf but that would be the problem causing not being able to send or receive/sort mail. As for dovecot, I just need to make sure it is using maildir style as well. Then the emails (if postfix did receive and sort them correctly) will show in the inbox.

[EDIT]I am wondering what would happen if I swapped the sources.lst for the original one and did an update/upgrade… Would that essentially make it download and install the original packages? If that is the case, as long as the server still works, I should be able to install virtualmin without problems…[/EDIT]

I’m glad you got it working! Thanks for posting your solution.

-Eric

I FIXED IT~~!!!

Admins, I think these following instructions should be added to the documentation… Maybe make a link on the “Download” page that says “VPS USERS CLICK HERE” and add the warnings below.

DO:

  • Make backups of everything prior to attempting this
  • Double check your DNS and be sure you have a reverse pointer set by your webhost who provided you with the IP adresses for your server
  • Follow these instructions carefully

DO NOT DO THIS IF:

  • You are not able to reinstall your VPS from a control panel
  • It cost's you money to reinstall your VPS
  • You haven't made backups

FIX THIS BY:

  1. Install a new copy of Debian x64 (or other) from VPS control panel
  2. Log into the shell with username "root".
  3. Set hostname & mailname (/etc/hostname and /etc/mailname) Hostname being server.yourdomain.com and mailname being yourdomain.com
  4. Replace /etc/apt/sources.lst with original one from distribution (copy from the SAME version of linux)
  5. "apt-get update && apt-get upgrade"
  6. wget http://software.virtualmin.com/gpl/scripts/install.sh
  7. sh install.sh
  8. Add a server, Add an email account, install squirrelmail or other, and send an email to your hotmail account!

Finally:As long as the reverse ptr is there and your VPS works fine on normal repos, you should have a knife through butter type installation.

Admins, if you could please close this thread, the solution is posted. Thank you kindly!

Thanks:
Thanks Andreychek for your help! If you hadn’t mentioned about the different repos I would never have found this fix :smiley: