Page 1 of 2 12 LastLast
Results 1 to 10 of 16

Thread: Low memory IMAP server for use with PHP mail()

  1. #1
    Join Date
    Oct 2012
    Location
    Geekland
    Beans
    Hidden!
    Distro
    Kubuntu

    Question Low memory IMAP server for use with PHP mail()

    I am looking for an IMAP server that I can limit/runs on 100MB of ram or less, integrates easily with the PHP mail function, and will support: 2 Thunderbird clients and 2 K9Mail clients. I would also like a tutorial on setting it up (I'm a n00b in the mail server department ). I know I need a mail relay and I get one free with my server, but that's the extent of my knowledge when it comes to running a mail server. Any and all suggestions, links, and help is greatly appreciated.

    Sincerely,
    Patrick Thomas (Timberwolf)
    Timberwolf Programmers Owner & Founder


  2. #2
    Join Date
    Nov 2008
    Location
    Metro Boston
    Beans
    9,041
    Distro
    Kubuntu 14.04 Trusty Tahr

    Re: Low memory IMAP server for use with PHP mail()

    The two most common IMAP servers are dovecot and the much older UW-imap. I'm running dovecot on one server. The total footprint is 2 MB, but only 572 of that is unique to dovecot. There are a couple of helper programs like dovecot-auth, but they are pretty tiny.

    I don't know what your provider supplies in terms of a "mail relay," but you'll also need an SMTP server like Postfix or sendmail. Dovecot just provides delivery services for existing messages. (It's called a "Mail User Agent" in the parlance; something like sendmail is a "Mail Transfer Agent.")
    If you ask for help, please have the courtesy to check for responses and thank the people who helped you.

    Blog · Linode System Administration Guides · Android Apps for Ubuntu Users

  3. #3
    Join Date
    Oct 2012
    Location
    Geekland
    Beans
    Hidden!
    Distro
    Kubuntu

    Re: Low memory IMAP server for use with PHP mail()

    Quote Originally Posted by SeijiSensei View Post
    The two most common IMAP servers are dovecot and the much older UW-imap. I'm running dovecot on one server.
    Yeah, I was looking at dovecot...
    Quote Originally Posted by SeijiSensei View Post
    The total footprint is 2 MB, but only 572 of that is unique to dovecot. There are a couple of helper programs like dovecot-auth, but they are pretty tiny.
    When you say "total footprint is 2 MB" do you mean entire server? and when you say "only 572 of that is unique to dovecot" do you mean 572 KB? I just don't see how you can get it so low... Granted I am running apache, mysql, sks, ssh, and a few other things but I don't see how it's possible...
    Quote Originally Posted by SeijiSensei View Post
    I don't know what your provider supplies in terms of a "mail relay,"
    Rackspace provides a mail relay free of charge (for 50,000 mesages per month) and I think it's mailgun, but I don't remember...
    Quote Originally Posted by SeijiSensei View Post
    but you'll also need an SMTP server like Postfix or sendmail. Dovecot just provides delivery services for existing messages. (It's called a "Mail User Agent" in the parlance; something like sendmail is a "Mail Transfer Agent.")
    Ok, that should be easy enough... Can I get a few links for some tutorials?

    Sincerely,
    Patrick Thomas (Timberwolf)
    Timberwolf Programmers Owner & Founder


  4. #4
    Join Date
    Nov 2008
    Location
    Metro Boston
    Beans
    9,041
    Distro
    Kubuntu 14.04 Trusty Tahr

    Re: Low memory IMAP server for use with PHP mail()

    For documentation I'd start with the Ubuntu Server Guide.

    Yes, I mean the total footprint of the dovecot server is 2 MB with a unique 576K segment. The rest of the code is shared, largely via libc. Most servers run in small memory segments since they don't have to interface with many parts of the operating system. Basically all the server does is act on IMAP commands after authentication. It reads the commands and spits back output to your mail reader.

    I've run text-based servers in as little as 64MB even in recent years. The first servers I built and sold were on i386 platforms with, maybe, 16 MB of memory total. I could build a combined web/DNS/dialup/email server on one of these in the mid 1990s.
    Last edited by SeijiSensei; October 28th, 2013 at 07:24 PM.
    If you ask for help, please have the courtesy to check for responses and thank the people who helped you.

    Blog · Linode System Administration Guides · Android Apps for Ubuntu Users

  5. #5
    Join Date
    Oct 2012
    Location
    Geekland
    Beans
    Hidden!
    Distro
    Kubuntu

    Re: Low memory IMAP server for use with PHP mail()

    Quote Originally Posted by SeijiSensei View Post
    For documentation I'd start with the Ubuntu Server Guide.

    Yes, I mean the total footprint of the dovecot server is 2 MB with a unique 576K segment. The rest of the code is shared, largely via libc. Most servers run in small memory segments since they don't have to interface with many parts of the operating system. Basically all the server does is act on IMAP commands after authentication. It reads the commands and spits back output to your mail reader.

    I've run text-based servers in as little as 64MB even in recent years. The first servers I built and sold were on i386 platforms with, maybe, 16 MB of memory total. I could build a combined web/DNS/dialup/email server on one of these in the mid 1990s.
    Ok, the link you provided was a bit confusing but I found this and these: UserDatabase, AuthDatabase/PasswdFile, and BasicConfiguration and now dovecot & postfix is running, however I cannot connect.

    Here is my main DNS records and the mailing system records:
    twprogrammers.com A 50.56.177.159
    twprogrammers.com NS dns1.stabletransit.com
    twprogrammers.com NS dns2.stabletransit.com
    twprogrammers.com MX twprogrammers.com Priority: 10
    www.twprogrammers.com CNAME twprogrammers.com
    twprogrammers.com TXT v=spf1 include:mailgun.org ~all
    krs._domainkey.twprogrammers.com TXT REMOVED

    Output of dovecot -n:
    Code:
    # 2.0.19: /etc/dovecot/dovecot.conf# OS: Linux 3.2.0-24-virtual x86_64 Ubuntu 12.04.3 LTS
    mail_location = maildir:~/Maildir
    managesieve_notify_capability = mailto
    managesieve_sieve_capability = fileinto reject envelope encoded-character vacation subaddress comparator-i;ascii-numeric relational regex imap4flags copy include variables body enotify environment mailbox date ihave
    passdb {
      args = /etc/passwd.dovecot
      driver = passwd
    }
    plugin {
      sieve = ~/.dovecot.sieve
      sieve_dir = ~/sieve
    }
    protocols = imap pop3 sieve
    service auth {
      unix_listener /var/spool/postfix/private/dovecot-auth {
        group = postfix
        mode = 0660
        user = postfix
      }
    }
    ssl_cert = </etc/ssl/certs/dovecot.pem
    ssl_cipher_list = ALL:!LOW:!SSLv2:ALL:!aNULL:!ADH:!eNULL:!EXP:RC4+RSA:+HIGH:+MEDIUM
    ssl_key = </etc/ssl/private/dovecot.pem
    userdb {
      args = /etc/passwd.dovecot
      driver = passwd
    }
    protocol imap {
      imap_client_workarounds = tb-extra-mailbox-sep
      mail_max_userip_connections = 10
    }
    protocol pop3 {
      mail_max_userip_connections = 10
      pop3_client_workarounds = outlook-no-nuls oe-ns-eoh
    }
    protocol lda {
      deliver_log_format = msgid=%m: %$
      mail_plugins = sieve
      postmaster_address = postmaster
      quota_full_tempfail = yes
      rejection_reason = Your message to <%t> was automatically rejected:%n%r
    }
    Passwd File:
    Code:
    admin@twprogrammers.com:{PLAIN}REMOVED
    Last edited by wolfgentleman; October 29th, 2013 at 09:18 PM. Reason: added passwd file

    Sincerely,
    Patrick Thomas (Timberwolf)
    Timberwolf Programmers Owner & Founder


  6. #6
    Join Date
    Nov 2008
    Location
    Metro Boston
    Beans
    9,041
    Distro
    Kubuntu 14.04 Trusty Tahr

    Re: Low memory IMAP server for use with PHP mail()

    For security purposes dovecot, like most Ubuntu daemons, is bound to the localhost interface by default. Try adding "listen=*" as described here.

    You can see if this is the problem right away by trying "telnet localhost 143" and "telnet your.external.ip.addr 143". If the first works, and the second does not, you need to add the "listen".
    If you ask for help, please have the courtesy to check for responses and thank the people who helped you.

    Blog · Linode System Administration Guides · Android Apps for Ubuntu Users

  7. #7
    Join Date
    Oct 2012
    Location
    Geekland
    Beans
    Hidden!
    Distro
    Kubuntu

    Re: Low memory IMAP server for use with PHP mail()

    Quote Originally Posted by SeijiSensei View Post
    For security purposes dovecot, like most Ubuntu daemons, is bound to the localhost interface by default. Try adding "listen=*" as described here.

    You can see if this is the problem right away by trying "telnet localhost 143" and "telnet your.external.ip.addr 143". If the first works, and the second does not, you need to add the "listen".
    Ok, I did it as well as a few other tweaks and it still does not connect. Here is the output of dovecot -n:
    Code:
    # 2.0.19: /etc/dovecot/dovecot.conf
    # OS: Linux 3.2.0-24-virtual x86_64 Ubuntu 12.04.3 LTS ext3
    auth_debug = yes
    auth_debug_passwords = yes
    auth_mechanisms = plain login digest-md5 cram-md5
    auth_verbose = yes
    auth_verbose_passwords = plain
    debug_log_path = /etc/dovecot/logsdovecot.zip/dovecot-debug.log
    disable_plaintext_auth = no
    info_log_path = /etc/dovecot/logs/dovecot-info.log
    log_path = /etc/dovecot/logs/dovecot-error.log
    mail_attachment_dir = /home/twp/Maildir/.attachments
    mail_attachment_hash = %{sha1:16}%{size}%{md4:16}
    mail_attachment_min_size = 1 B
    mail_location = maildir:/home/twp/Maildir
    managesieve_notify_capability = mailto
    managesieve_sieve_capability = fileinto reject envelope encoded-character vacation subaddress comparator-i;ascii-numeric relational regex imap4flags copy include variables body enotify environment mailbox date ihave
    passdb {
      args = /etc/passwd.dovecot
      driver = passwd
    }
    protocols = imap
    service auth {
      unix_listener /var/spool/postfix/private/dovecot-auth {
        group = postfix
        mode = 0660
        user = postfix
      }
    }
    service imap-login {
      inet_listener imap {
        address = *
        port = 143
      }
      inet_listener imaps {
        address = *
        port = 993
      }
    }
    service imap {
      process_limit = 10
      vsz_limit = 100 M
    }
    ssl_cert = </etc/ssl/certs/dovecot.pem
    ssl_cipher_list = ALL:!LOW:!SSLv2:ALL:!aNULL:!ADH:!eNULL:!EXP:RC4+RSA:+HIGH:+MEDIUM
    ssl_key = </etc/ssl/private/dovecot.pem
    userdb {
      args = /etc/passwd.dovecot
      driver = passwd
    }
    protocol imap {
      imap_client_workarounds = tb-extra-mailbox-sep
      mail_max_userip_connections = 10
    }
    I am attaching the log files.
    dovecot.zip

    Sincerely,
    Patrick Thomas (Timberwolf)
    Timberwolf Programmers Owner & Founder


  8. #8
    Join Date
    Nov 2008
    Location
    Metro Boston
    Beans
    9,041
    Distro
    Kubuntu 14.04 Trusty Tahr

    Re: Low memory IMAP server for use with PHP mail()

    You have "address = *" where I believe the syntax should be "listen = *".

    The error log complains about not being able to connect to the authentication service. I just create local accounts on the machine and authenticate against /etc/passwd. If you're using some other mechanism like MySQL in the back end, maybe the problem lies in the interface between them.
    If you ask for help, please have the courtesy to check for responses and thank the people who helped you.

    Blog · Linode System Administration Guides · Android Apps for Ubuntu Users

  9. #9
    Join Date
    Oct 2012
    Location
    Geekland
    Beans
    Hidden!
    Distro
    Kubuntu

    Re: Low memory IMAP server for use with PHP mail()

    Quote Originally Posted by SeijiSensei View Post
    You have "address = *" where I believe the syntax should be "listen = *".
    When I use listen = * I get:
    Code:
    # 2.0.19: /etc/dovecot/dovecot.conf
    doveconf: Fatal: Error in configuration file /etc/dovecot/dovecot.conf line 54: Unknown setting: listen
    doveconf: Error: managesieve-login: dump-capability process returned 89
    doveconf: Fatal: Error in configuration file /etc/dovecot/dovecot.conf line 54: Unknown setting: listen
    Quote Originally Posted by SeijiSensei View Post
    The error log complains about not being able to connect to the authentication service. I just create local accounts on the machine and authenticate against /etc/passwd. If you're using some other mechanism like MySQL in the back end, maybe the problem lies in the interface between them.
    I am using passwd file
    Code:
    passdb {
      args = /etc/passwd.dovecot
      driver = passwd
    }
    userdb {
      args = /etc/passwd.dovecot
      driver = passwd
    }
    Here is the contents of /etc/passwd.dovecot
    Code:
    admin@twprogrammers.com:{PLAIN}REMOVED
    EDIT:
    I fixed half the problem driver = passwd is supposed to be driver = passwd-file. Now the problem is the passwd.dovecot, I did not realize that the rest of the line was required because this said otherwise - misinterpreted... Looking to fix it now...

    Code:
    Oct 31 19:34:49 auth: Error: passwd-file /etc/passwd.dovecot: User admin@twprogrammers.com is missing userdb info
    Oct 31 19:34:49 imap(admin@twprogrammers.com): Error: user admin@twprogrammers.com: Couldn't drop privileges: User is missing UID (see mail_uid setting)
    Oct 31 19:34:49 imap(admin@twprogrammers.com): Error: Internal error occurred. Refer to server log for more information.
    UPDATE:
    I got IMAP login working now, just need to setup SSL/TLS, postfix login, IMAP folders, and a more secure passwd file but I will need help there as well. Thank you for all the help you have provided.


    Happy Halloween!!!
    Last edited by wolfgentleman; October 31st, 2013 at 09:05 PM.

    Sincerely,
    Patrick Thomas (Timberwolf)
    Timberwolf Programmers Owner & Founder


  10. #10
    Join Date
    Oct 2012
    Location
    Geekland
    Beans
    Hidden!
    Distro
    Kubuntu

    Re: Low memory IMAP server for use with PHP mail()

    IMAP is working now but the folders are not setup. Postfix however is... malfunctioning. It won't connect on the SSL/TLS port and when I try to connect through port 25 it barks on thunderbird and k-9, but mutt seems to work fine - connects, reads, and sends mail. I think it doesn't like port 25 because I have it set to only allow SSL/TLS. I am attaching the configs.
    configs.zip

    Sincerely,
    Patrick Thomas (Timberwolf)
    Timberwolf Programmers Owner & Founder


Page 1 of 2 12 LastLast

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •