Step by step email setup for domain & clients

Discussion in 'Installation/Configuration' started by aurasdoom, Jan 17, 2010.

  1. aurasdoom

    aurasdoom New Member

    So what do I have to do to setup email for a domain, let's say website.com, add emails for that domain so that I can:
    - send emails via smtp
    - receive emails
    ?

    I have DNS setup
    I added the email domain website.com
    I added an email emailuser@website.com with quota 0 (i guess that means unlimited?) with receiving, imap and pop enabled.
    So far I could check my email (I moved them from another server and set the proper permissions)
    But I couldn't receive nor send emails.

    I managed to make sending of emails work by adding in the postfix whitelist 3 records:
    website.com type:sender
    unknown type:client
    com type:recipient

    But that meant I could only send to *@*.com
    So how do I get rid of this? I only want it to check against the sender, not the client and the recipient also.

    And as for the incoming emails not... coming:

    Code:
    This is the mail system at host website.com.
    
    I'm sorry to have to inform you that your message could not
    be delivered to one or more recipients. It's attached below.
    
    For further assistance, please send mail to <postmaster>
    
    If you do so, please include this problem report. You can
    delete your own text from the attached returned message.
    
                      The mail system
    
    <emailuser@website.com>: unknown user: "emailuser"
    Reporting-MTA: dns; website.com
    X-Postfix-Queue-ID: 008091BCD0FC
    X-Postfix-Sender: rfc822; ***@gmail.com
    Arrival-Date: Sun, 17 Jan 2010 02:45:32 +0300 (MSK)
    
    Final-Recipient: rfc822; [email]emailuser@website.com[/email]
    Original-Recipient: rfc822;emailuser@website.com
    Action: failed
    Status: 5.1.1
    Diagnostic-Code: X-Postfix; unknown user: "emailuser"
    Code:
    Jan 17 02:49:34 wip postfix/smtpd[25768]: connect from mail-ew0-f209.google.com[209.85.219.209]
    Jan 17 02:49:34 wip postfix/trivial-rewrite[25854]: warning: do not list domain website.com in BOTH mydestination and virtual_mailbox_domains
    Jan 17 02:49:34 wip postfix/smtpd[25768]: 6E1E51BCC0C7: client=mail-ew0-f209.google.com[209.85.219.209]
    Jan 17 02:49:34 wip postfix/cleanup[25912]: 6E1E51BCC0C7: message-id=<0247A40E-360E-4722-A18B-A88B95F001B9@gmail.com>
    Jan 17 02:49:34 wip postfix/qmgr[16064]: 6E1E51BCC0C7: from=<******@gmail.com>, size=2007, nrcpt=1 (queue active)
    Jan 17 02:49:34 wip amavis[14195]: (14195-02) (!!)WARN: all primary virus scanners failed, considering backups
    Jan 17 02:49:41 wip postfix/smtpd[5424]: connect from unknown[127.0.0.1]
    Jan 17 02:49:41 wip postfix/trivial-rewrite[25854]: warning: do not list domain website.com in BOTH mydestination and virtual_mailbox_domains
    Jan 16 23:49:41 wip postfix/smtpd[5424]: 149681BCD111: client=mail-ew0-f209.google.com[209.85.219.209]
    Jan 17 02:49:41 wip postfix/cleanup[25912]: 149681BCD111: message-id=<0247A40E-360E-4722-A18B-A88B95F001B9@gmail.com>
    Jan 17 02:49:41 wip postfix/qmgr[16064]: 149681BCD111: from=<******@gmail.com>, size=2397, nrcpt=1 (queue active)
    Jan 16 23:49:41 wip postfix/smtpd[5424]: disconnect from unknown[127.0.0.1]
    Jan 17 02:49:41 wip postfix/trivial-rewrite[25854]: warning: do not list domain website.com in BOTH mydestination and virtual_mailbox_domains
    Jan 17 02:49:41 wip amavis[14195]: (14195-02) Passed CLEAN, [209.85.219.209] [x.x.x.x] <******@gmail.com> -> <emailuser@website.com>, Message-ID: <0247A40E-360E-4722-A18B-A88B95F001B9@gmail.com>, mail_id: FiCD4crbiQPw, Hits: 3.384, size: 2007, queued_as: 149681BCD111, dkim_id=@gmail.com,******@gmail.com, 6534 ms
    Jan 17 02:49:41 wip postfix/smtp[26024]: 6E1E51BCC0C7: to=<emailuser@website.com>, relay=127.0.0.1[127.0.0.1]:10024, delay=6.7, delays=0.16/0.01/0/6.5, dsn=2.0.0, status=sent (250 2.0.0 Ok, id=14195-02, from MTA([127.0.0.1]:10025): 250 2.0.0 Ok: queued as 149681BCD111)
    Jan 17 02:49:41 wip postfix/qmgr[16064]: 6E1E51BCC0C7: removed
    Jan 17 02:49:41 wip postfix/local[5447]: 149681BCD111: to=<emailuser@website.com>, relay=local, delay=0.08, delays=0.01/0.06/0/0.01, dsn=5.1.1, status=bounced (unknown user: "emailuser")
    Jan 17 02:49:41 wip postfix/cleanup[25912]: 279071BCD113: message-id=<20100116234941.279071BCD113@website.com>
    Jan 17 02:49:41 wip postfix/qmgr[16064]: 279071BCD113: from=<>, size=4087, nrcpt=1 (queue active)
    Jan 17 02:49:41 wip postfix/bounce[5496]: 149681BCD111: sender non-delivery notification: 279071BCD113
    Jan 17 02:49:41 wip postfix/qmgr[16064]: 149681BCD111: removed
    Jan 17 02:49:43 wip postfix/smtp[5519]: 279071BCD113: to=<******@gmail.com>, relay=gmail-smtp-in.l.google.com[72.14.221.114]:25, delay=2.4, delays=0.02/0.01/2.1/0.24, dsn=2.0.0, status=sent (250 2.0.0 OK 1263685783 e11si8927169fga.14)
    Jan 17 02:49:43 wip postfix/qmgr[16064]: 279071BCD113: removed
    Jan 17 02:50:04 wip postfix/smtpd[25768]: disconnect from mail-ew0-f209.google.com[209.85.219.209]
    Jan 17 02:51:33 wip postfix/trivial-rewrite[25854]: warning: do not list domain website.com in BOTH mydestination and virtual_mailbox_domains
    Jan 17 02:51:33 wip postfix/cleanup[10168]: D6AA21BCD111: message-id=<2AD65C81-522F-4DB5-8606-5A1E79023D99@website.com>
    Jan 17 02:51:34 wip postfix/qmgr[16064]: D6AA21BCD111: from=<emailuser@website.com>, size=5475, nrcpt=1 (queue active)
    Jan 17 02:51:34 wip amavis[14194]: (14194-03) (!!)WARN: all primary virus scanners failed, considering backups
    Jan 17 02:51:40 wip postfix/smtpd[22380]: connect from unknown[127.0.0.1]
    Jan 17 02:51:40 wip postfix/trivial-rewrite[25854]: warning: do not list domain website.com in BOTH mydestination and virtual_mailbox_domains
    Jan 17 02:51:40 wip postfix/cleanup[10168]: 837501BCD112: message-id=<2AD65C81-522F-4DB5-8606-5A1E79023D99@website.com>
    Jan 16 23:51:40 wip postfix/smtpd[22380]: disconnect from unknown[127.0.0.1]
    Jan 17 02:51:40 wip postfix/qmgr[16064]: 837501BCD112: from=<emailuser@website.com>, size=5865, nrcpt=1 (queue active)
    Jan 17 02:51:40 wip postfix/trivial-rewrite[25854]: warning: do not list domain website.com in BOTH mydestination and virtual_mailbox_domains
    Jan 17 02:51:40 wip amavis[14194]: (14194-03) Passed CLEAN, [x.x.x.x] [x.x.x.x] <emailuser@website.com> -> <emailuser@website.com>, Message-ID: <2AD65C81-522F-4DB5-8606-5A1E79023D99@website.com>, mail_id: vjMOE5dP+B1P, Hits: 4.462, size: 5475, queued_as: 837501BCD112, 6541 ms
    Jan 17 02:51:40 wip postfix/smtp[11336]: D6AA21BCD111: to=<emailuser@website.com>, relay=127.0.0.1[127.0.0.1]:10024, delay=6.8, delays=0.21/0.01/0/6.5, dsn=2.0.0, status=sent (250 2.0.0 Ok, id=14194-03, from MTA([127.0.0.1]:10025): 250 2.0.0 Ok: queued as 837501BCD112)
    Jan 17 02:51:40 wip postfix/qmgr[16064]: D6AA21BCD111: removed
    Jan 17 02:51:40 wip postfix/local[22482]: 837501BCD112: to=<emailuser@website.com>, relay=local, delay=0.08, delays=0.06/0.01/0/0.01, dsn=5.1.1, status=bounced (unknown user: "emailuser")
    Jan 17 02:51:40 wip postfix/cleanup[10168]: 961AE1BCD113: message-id=<20100116235140.961AE1BCD113@website.com>
    Jan 17 02:51:40 wip postfix/qmgr[16064]: 961AE1BCD113: from=<>, size=7547, nrcpt=1 (queue active)
    Jan 17 02:51:40 wip postfix/bounce[22486]: 837501BCD112: sender non-delivery notification: 961AE1BCD113
    Jan 17 02:51:40 wip postfix/trivial-rewrite[25854]: warning: do not list domain website.com in BOTH mydestination and virtual_mailbox_domains
    Jan 17 02:51:40 wip postfix/qmgr[16064]: 837501BCD112: removed
    Jan 17 02:51:40 wip postfix/local[22482]: 961AE1BCD113: to=<emailuser@website.com>, relay=local, delay=0.01, delays=0.01/0/0/0, dsn=5.1.1, status=bounced (unknown user: "emailuser")
    Jan 17 02:51:40 wip postfix/qmgr[16064]: 961AE1BCD113: removed
    
     
  2. maverick

    maverick New Member

    I've just done a migration to using Postfix etc myself using the excellent guide on this site and would reccomend either running through that or at least using it as a reference for checking how you have configured your site.

    The maillog you post shows some issues, such as duplicate entries for host-domain and virtual domain definitions, that you should try and address.

    Not being an expert on Linux my only other advice,, based on issues I had, were to disable SELinux security and the firewall until you have everything working and then make small changes to secure the server.

    Good luck

    Mark
     
  3. aurasdoom

    aurasdoom New Member

    Really guys it isn't working. I'm losing my mind over here by the hour. I've renamed myhostname so that there aren't any duplicates in virtual-domains.

    But of course that wasn't the problem, it couldn't be that simple.

    Please, for the love of god 'cause I haven't done this before, tell me what are the steps to follow in ISPConfig make sure I at least can receive emails.

    I even added right now my domain in the whitelist with type recipient and it still bounces the email on the count that the user i'm trying to send to (on my domain) doesn't exist. But the hell it does exist.

    I'll post the mysql query log with what queries postfix does when it receives an email I send from gmail and which queries return something or not based on what's in the table.

    mail_transport and mail_forwarding tables are empty
     
  4. aurasdoom

    aurasdoom New Member

    Hm... I found the reason for:
    The user emailuser doesn't exist on linux. If I add it:

    But obviously it goes to the mailbox of the linux user and not the virtual mailbox.

    So here lies the problem. Which module handles this? And what's wrong with it's configuration? Note that before this I told ISPConfig to remake it's configuration files.

    LE: The problem must be in SASL and in postfix. I'm running CentOS 5.4 i think (either this or 5.3) and the first thing I found is that the smtpd.conf file was not configured.
    SASL's smtpd.conf file in centos is in /usr/lib/sasl2/smtpd.conf and ISPConfig tries to write /etc/postfix/sasl/smptd.conf
    Anyway I configured them both properly.. I think:
    Even later edit: I don't see anywhere in postfix to configure SASL parameters
     
    Last edited: Jan 17, 2010
  5. till

    till Super Moderator Staff Member ISPConfig Developer

    Download the latest ispconfig (3.0.1.6), unpavk it and then run the update.php script again and select to reconfigure services. It is not nescessary to change any file manually on centos 5.4 32bit or 64Bit, and I'am doing this installs daily, they are just working out of the box. Make sure that you followed the perfect server guide to the letter before you installed ispconfig.
     
  6. aurasdoom

    aurasdoom New Member

    Yes, I followed the perfect server guide and yes I already ran the update.php this morning to try again and no, it didn't fix it.

    I managed to isolate the problem to postfix not using sasl properly. When connecting to the smtp port it's not using authentication at all.

    Code:
    $ telnet website.com 25
    Trying X.X.X.X...
    Connected to website.com.
    Escape character is '^]'.
    220 ns1.website.com ESMTP Postfix
    helo website.com
    250 ns1.website.com
    exit
    502 5.5.2 Error: command not recognized
    quit
    221 2.0.0 Bye
     
  7. till

    till Super Moderator Staff Member ISPConfig Developer

    Then you might have compiled postfix without sasl. But sasl is not even needed to receive emails, it is just needed when you send emails to non local recipients. So I dont think that thats the problem, most likely your postfix does not even support virtual users at all or has no mysql compiled in. You should recompile and reinstall tzhe new postfix as described in the perfect server guide:

    http://www.howtoforge.com/perfect-server-centos-5.4-x86_64-ispconfig-3-p4
     
  8. aurasdoom

    aurasdoom New Member

    I don't know about sasl support but you can see above that mysql works but virtual users don't and that's why it keeps bouncing emails. Also, yes, i did compile it like that. How can I check what modules postfix is compiled with?
     
  9. till

    till Super Moderator Staff Member ISPConfig Developer

    Please install squirrelmail on the server if you did it not already. Then login to a local email account in squirrelmail and send a email to this exact same email account. Then post all lines that got added in the mail log file.

    Also run these commands and post the output:

    postconf -d | grep sasl

    and

    postconf -n | grep sasl
     
  10. aurasdoom

    aurasdoom New Member

    Here's from maillog after trying to send from squirrelmail:

    Not that it's any concludent. Apparently it's trying to use sendmail which isn't running.

     
  11. till

    till Super Moderator Staff Member ISPConfig Developer

    Sendmail is the name of the postfix sendmail wrapper an part of every postfix configuration, os the log lines are ok.

    The output of the postf´conf commands is ok.

    Please post the output of:

    netstat -tap | grep smtp

    and the content of the /etc/hosts file.
     
  12. aurasdoom

    aurasdoom New Member

    Here it is:
    Code:
    # netstat -tap | grep smtp
    getnameinfo failed
    getnameinfo failed
    getnameinfo failed
    getnameinfo failed
    # cat /etc/hosts
    127.0.0.1 localhost.localdomain localhost
    # Auto-generated hostname. Please do not remove this comment.
    93.115.250.113 wip.ro  wip wip
     
  13. aurasdoom

    aurasdoom New Member

    About the before squirrelmail problem it seemed that postfix was stopped, silly me :)

    Here's the log now:
    And no, I didn't write the TLD twice when sending the mail.
     
  14. aurasdoom

    aurasdoom New Member

    Another bug I found when using SMTP SASL authentication.
    I tried to authenticat with something like emailuser@mydomain.com and it's password but SASL queries the mysql users table like this:
    And I don't imagine why not because it's setup like this:
    Emphasis on what I have bolded. Shouldn't it check for the full emailuser@mydomain.com ?

    I've even changed it to %u@%d and it still queries without the domain. This is madness
     
    Last edited: Jan 18, 2010
  15. till

    till Super Moderator Staff Member ISPConfig Developer

    There is no problem with sasl according to the log files and I told you already that sasl is not even involved in receiving the emails! Do not change anything in the sasl files, it will just cause more problems. If the setup works on then thousands of servers with the exact files that are in the ispconfig installer, it will work on your server too. We just have to figure out where your server is configured wrong and when you change the working default files of ispconfig, we can stop right here as we will not find the problem then.

    According to the mail log file, your server forwards the email to the server 87.106.16.229. Is this the IP of the local server?
     
  16. aurasdoom

    aurasdoom New Member

    M.. no. I sent the email to auras at wip.ro (my server) but somehow postfix (or squirrelmail) decided to send it to auras at wip.ro.ro and that's where that ip came from.
     
    Last edited: Jan 18, 2010
  17. till

    till Super Moderator Staff Member ISPConfig Developer

    Please check the settings in squirrelmail under otions and make sure that you have set a correct sender address there.
     
  18. aurasdoom

    aurasdoom New Member

    I reran php -q update.php to remake the configuration files and smtpd authentication now works which it didn't before.

    But receiving emails still doesn't work. The same problem: unknown user "xxxxxx"

    I'm posting these again, maybe someone knows what's wrong with postfix:

    It's checking wrong. It should check for auras @ wip.ro.

    Someone with centos 5.4 can please post their postfix/sasl configuration?


    Aaaand yes, I found the solution:
    Jan 19 14:46:41 wip postfix/trivial-rewrite[26080]: warning: do not list domain wip.ro in BOTH mydestination and virtual_mailbox_domains

    Thanks all, and sorry for the fuss :)
     
    Last edited: Jan 19, 2010

Share This Page