# E-mail still not working.  Going to wrong folder.

## CurtE

This is the response I receive from a test e-mail.  I sent the message to curt@cs-mn.com, admin@cs-mn.com and postmaster@cs-mn.com.  This is the only one that received an immediate rejection.

<admin@cs-mn.com>: maildir delivery failed: create maildir file

    /home/admin//.maildir/tmp/1255178948.P8632.csmn1: Permission denied

The part that jumps out immediately is in red.  Any clues on why I get a double "//"?

Also, I receive the message in /var/spool/mail/.maildir/new but nothing in /home/vmail/cs-mn.com/???/.maildir (??? = admin/curt/postmaster).  

Am I missing something that redirects the mail to the appropriate folder?Last edited by CurtE on Sun Oct 18, 2009 11:34 am; edited 1 time in total

----------

## CurtE

No one has an idea?  That's odd.

----------

## doctork

The double slash shouldn't make any difference.

What are you using to receive mail?

Does /home/admin/.maildir exist, and if so what sort of permissions does it have? 

--

doc

----------

## CurtE

Thanks for the reply, doc.

I've been trying to get SquirrelMail to work but I'm haveing issues with IMAP or something.

I've been going thru the logs and finding the little bugs and fixing them.  One was a mis-spelling of "authentication", should have been "authenticated".

csmn1 vmail # ls -al *

cs-mn.com:

total 20

drwxr-xr-x 5 1004 vmail 4096 Oct 10 07:28 .

drwxr-xr-x 4 1004 vmail 4096 Oct  6 00:34 ..

drwxr-xr-x 3 1004 vmail 4096 Sep  7 10:13 admin

drwxr-xr-x 2 1004 vmail 4096 Oct 10 07:28 curt

drwxr-xr-x 3 1004 vmail 4096 Sep  7 10:44 postmaster

admin:

total 12

drwxr-xr-x 3 1004 vmail 4096 Sep  7 10:13 .

drwxr-xr-x 5 1004 vmail 4096 Oct 10 07:28 ..

drwxr-xr-x 5 1004 vmail 4096 Sep  7 10:13 .maildir

csmn1 admin # cd .maildir/

drwxr-xr-x 5 1004 vmail 4096 Sep  7 10:13 .

drwxr-xr-x 3 1004 vmail 4096 Sep  7 10:13 ..

drwx------ 2 1004 vmail 4096 Sep  7 10:13 cur

drwx------ 2 1004 vmail 4096 Sep  7 10:13 new

drwx------ 2 1004 vmail 4096 Sep  7 10:13 tmp

I just noticed the '1004', I don't know why I hadn't before.  That is ClamAV, although I haven't gotten past the emerge with that.

Curiousity question.  I might unmerge ClamAV since a new version will probably be out before I get it setup proper.  What would the 1004 change to?

----------

## doctork

 *CurtE wrote:*   

> Thanks for the reply, doc.
> 
> I've been trying to get SquirrelMail to work but I'm haveing issues with IMAP or something.
> 
> I've been going thru the logs and finding the little bugs and fixing them.  One was a mis-spelling of "authentication", should have been "authenticated".
> ...

 

Given that "admin" might want to read his own e-mail, the owner of /home/admin/.maildir should probably be "admin".  As it stands at the moment, only users root and "1004" can read the mail directories. However, unless root is trying to deliver the mail, noone but "1004" can deliver the mail to admin.  If some of your other users can receive e-mail, you should look at their ~/.maildir directory structure and model admin's after them.

--

doc

----------

## CurtE

No mail is being delivered anywhere, that's the problem.

I'm going to unmerge ClamAV for now an see if that helps.  I can deal with ClamAV another day.

----------

## doctork

 *CurtE wrote:*   

> No mail is being delivered anywhere, that's the problem.
> 
> I'm going to unmerge ClamAV for now an see if that helps.  I can deal with ClamAV another day.

 Unless that fixes the ownership and permission problems on the .maildir directories, it's still not going to work.  I would expect the owner of ~/whoever/.maildir/* to be whoever.

--

doc

----------

## CurtE

Tried it both ways.  

Changed ownership/group to vmail/vmail, same results.

Changed ownership/group to admin/vmail, same results.

----------

## doctork

 *CurtE wrote:*   

> Tried it both ways.  
> 
> Changed ownership/group to vmail/vmail, same results.
> 
> Changed ownership/group to admin/vmail, same results.

   What users belong to the vmail group?  What process is trying to write to the mail boxes?  Under what user name does that process run?

--

doc

----------

## CurtE

Doc,

   What users belong to the vmail group?

      none.  I changed it and added "admin,curt,postmaster"

   What process is trying to write to the mail boxes?

How would I find that out?

   Under what user name does that process run?

How would I find that out?

Funny thing, now I have e-mail for 'curt' but not in the virtual location but in /home/curt.

----------

## doctork

I see you're using postfix.  Was it working before you started messing with Clamav?  I'd try doing "rm -rf /home/admin/.maildir" and sending mail again.  If you postfix configuration is correct, it should create the .maildir directory and put the e-mail in its proper place.

--

doc

----------

## CurtE

No.  Postfix had never worked.

The test e-mail was sent to curt@cs-mn.com, admin@cs-mn.com and postmaster@cs-mn.com.

There was a:

home/curt (originally there)

home/vmail/cs-mn.com/curt and

home/vmail/cs-mn.com/admin

when I started.

When I made a simple fix (can't remember what one), home/curt/.maildir received mail but nothing went to home/vmail/cs-mn.com/curt or the home/vmail/cs-mn.com/admin directory.  When I created a /home/admin directory, I immediately received mail.  Also, SquirrelMail is now working.  I think the complaint was due to not having a mailbox (home/admin).

This tells me that the setup has an error.

One thing that bothers me.  Since I'm using MySql, how does it populate the database?  How does the MySql 'aliases' table fit in.  The HowTo said to create the tables but fails to mention the logic behind the process.

----------

## JC99

When I first started to use Postfix it didn't work for me either. To get Postfix to work correctly I ran the following command...

```
/usr/bin/newaliases
```

...I don't know if you have done that, try it and see if everything starts to work.

----------

## CurtE

I couldn't remember if I did or not, so I did it (again?) but nothing changed.

I guess I'll search the net on Postfix/MySQL/Aliases to see what I can find.

Maybe someone can see an error in my main.cf

```
queue_directory = /var/spool/postfix

command_directory = /usr/sbin

daemon_directory = /usr/lib/postfix

data_directory = /var/lib/postfix

 

mail_owner = postfix

myhostname = csmn1.cs-mn.com

mydomain = cs-mn.com

 

inet_interfaces = all

mydestination = $myhostname, localhost.$mydomain, localhost, $mydomain

unknown_local_recipient_reject_code = 550

mynetworks = 70.89.201.10, 127.0.0.0/8

 

alias_maps = mysql:/etc/postfix/mysql-aliases.cf

relocated_maps = mysql:/etc/postfix/mysql-relocated.cf

 

local_transport = local

local_recipient_maps = $alias_maps $virtual_mailbox_maps unix:passwd.byname

 

virtual_transport = virtual

virtual_mailbox_domains = flitezimz.com, blue-moose-gifts.com, reunions-with-flair.com

virtual_minimum_uid = 1000

virtual_gid_maps = static:1009

virtual_mailbox_maps = mysql:/etc/postfix/mysql-virtual-maps.cf

virtual_alias_maps = mysql:/etc/postfix/mysql-virtual.cf

virtual_uid_maps = static:1009

virtual_mailbox_base = /home/vmail

home_mailbox = .maildir/

 

smtpd_sasl_auth_enable = yes

smtpd_sasl2_auth_enable = yes

smtpd_sasl_security_options = noanonymous

broken_sasl_auth_clients = yes

smtpd_sasl_local_domain =

 

smtpd_recipient_restrictions =

  permit_sasl_authenticated,

  permit_mynetworks,

  reject_unauth_destination

 

smtp_use_tls = yes

smtp_tls_loglevel = 0

smtp_tls_note_starttls_offer = yes

smtpd_use_tls = yes

smtpd_tls_auth_only = no

smtpd_tls_key_file = /etc/postfix/newkey.pem

smtpd_tls_cert_file = /etc/postfix/newcert.pem

smtpd_tls_CAfile = /etc/postfix/cacert.pem

smtpd_tls_loglevel = 3

smtpd_tls_received_header = yes

smtpd_tls_session_cache_timeout = 3600s

tls_random_source = dev:/dev/urandom

 

local_destination_concurrency_limit = 2

default_destination_concurrency_limit = 10

 

debug_peer_level = 2

debugger_command =

   PATH=/bin:/usr/bin:/usr/local/bin:/usr/X11R6/bin

   ddd $daemon_directory/$process_name $process_id & sleep 5

 

sendmail_path = /usr/sbin/sendmail

newaliases_path = /usr/bin/newaliases

mailq_path = /usr/bin/mailq

setgid_group = postdrop

 

html_directory = /usr/share/doc/postfix-2.5.7/html

manpage_directory = /usr/share/man

sample_directory = /etc/postfix

readme_directory = /usr/share/doc/postfix-2.5.7/readme
```

----------

## doctork

I guess you're trying to swallow the whole enchillada at once -- virtual, sasl, mysql, etc.  You might want to get a more basic configuration working first. The only thing I see, given that you don't show your virtual mapping, is that you might want mynetworks to have 70.89.201.8/29 as opposed to 70.89.201.10.  I've never used mysql with postfix, but you probably should look at this,  *Quote:*   

> /usr/share/doc/postfix-2.5.7/readme/MYSQL_README

  if you haven't already.

--

doc

----------

## CurtE

Yep, I bit off a lot.  :Smile: 

```

...mynetworks to have 70.89.201.8/29 as opposed to 70.89.201.10.
```

Did you mean 70.89.201.10/29?

I had someone that said he'd help me through it when I found out that Qmail is on the way out, since it's not being supported.  Unfortunately, he hasn't been around lately.  Too many things going on, on his end, right now.

When I switch to this system, I thought it would be straight-forward but it never is for me.  I always have enough oddities in my stuff to make a mess of thing.

At this point, I'm not sure of what goes where?  What virtual-mapping?  Maybe this is where I need direction?

My assumption (I know, never assume  :Smile:  ) was that the system would update the database somehow.  Nothing indicated otherwise (unless I messed it).  I'll look at the doc you mentioned and let me know what you need to see to determine if I even have it.

----------

## doctork

 *CurtE wrote:*   

> Yep, I bit off a lot. 
> 
> ```
> 
> ...mynetworks to have 70.89.201.8/29 as opposed to 70.89.201.10.
> ...

 

No, I meant 70.89.201.8/29, since that's how whois describes you network.

By virtual mapping, I was referring to your "virtual_mailbox_maps" and "virtual_alias_maps".  As I said, I've never used mysql with postfix, but you do need to run postmap on your .cf files to load the database, I believe.  

You might also want to take a look at these:

```
http://www.gentoo.org/doc/en/virt-mail-howto.xml

http://www.gentoo.org/doc/en/mailfilter-guide.xml
```

Good luck!

--

doc

----------

## CurtE

Please post the whois you have, doesn't match mine (curiosity only).

The first link is how I set up my mailserver.  The second looks like something I'll want to do after I get this ironed out.  :Smile: 

I guess I need to find someone that has actually used the mysql part recently.  :Sad: 

That's probably a part of my problem.  I'm not sure if my entries are 100% correct.

----------

## doctork

 *CurtE wrote:*   

> Please post the whois you have, doesn't match mine (curiosity only).
> 
> The first link is how I set up my mailserver.  The second looks like something I'll want to do after I get this ironed out. 
> 
> I guess I need to find someone that has actually used the mysql part recently. 
> ...

  *Quote:*   

> $ whois \!NET-70-89-201-8-1
> 
> CustName:   Reunions With Flair
> 
> Address:    207 Yoho Dr,
> ...

 --

doc

----------

## CurtE

Okay, that's my entire static IP set.  If you had requested a whois on cs-mn.com, you would get something different.

Bear in mind, I still don't know what I'm talking about when it comes to this issue.  LOL

----------

