Announcement

Collapse
No announcement yet.

How do servers send and receive email?

Collapse
This topic is closed.
X
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • SteveRiley
    replied
    Originally posted by Feathers McGraw View Post
    my newly built Postfix & Dovecot email server is now up and running
    Congrats! I give ya six months; you'll find some reason to rebuild it, haha

    Originally posted by Feathers McGraw View Post
    I've tried sending emails to foo+facebook but the facebook folder isn't automatically created, the email appears in inbox... Is there a specific dovecot config setting that I need to set for this to happen?
    In /etc/postfix/main.cf, what is the mailbox_command line?

    In /etc/postfix/master.cf, do you have something like this:
    Code:
    # Use dovecot deliver program as LDA.
        flags=DRhu user=vmail:vmail argv=/usr/lib/dovecot/deliver -f ${sender} -d ${user}@${domain} -m ${extension}

    Leave a comment:


  • Feathers McGraw
    replied
    Originally posted by SteveRiley View Post
    When Postfix receives incoming mail, it ignores everything from the + up to the @. All it asks is, "Does alice@baz.org" live here?" If the answer is yes, Postfix accepts the message and invokes the delivery agent.

    Now it's Dovecot's turn to handle. If you have IMAP folders underneath your Inbox, then Dovecot will place incoming messages according to the address extension. Mail sent to alice+facebook@baz.org will get placed into the Facebook folder. Depending on how Dovecot is configured, if this folder doesn't exist, Dovecot will create it for you automatically. iRedMail configures Dovecot to create nonexistent folders. Ubuntu's mail-stack-delivery won't create folders; if you don't manually create them, Dovecot delivers to Inbox.
    Citadel... my newly built Postfix & Dovecot email server is now up and running

    I've tried sending emails to foo+facebook but the facebook folder isn't automatically created, the email appears in inbox.

    Is there a specific dovecot config setting that I need to set for this to happen?

    Feathers
    Last edited by SteveRiley; Nov 26, 2013, 01:59 AM.

    Leave a comment:


  • SteveRiley
    replied
    Originally posted by Feathers McGraw View Post
    Can you send email from an address with a + in it?
    I know I have replied to emails sent to name+thing@somewhere.tld, so yeah, that works.

    Originally posted by Feathers McGraw View Post
    I said aliases, but really I just meant another address book entry in citadel. Not sure how it does things behind the scenes because it has its own self-contained authorisation mechanism.
    "Alias" has a specific meaning, and it sounds like that's what you're doing: creating an email address that maps to some other actual account.

    I keep forgetting that you're using Citadel! Grr. I have no clue whether Citadel's SMTP and IMAP servers understand address extensions. You'll have to experiment to find out

    Leave a comment:


  • Feathers McGraw
    replied
    Nice!

    Can you send email from an address with a + in it?

    I said aliases, but really I just meant another address book entry in citadel. Not sure how it does things behind the scenes because it has its own self-contained authorisation mechanism.

    Feathers

    Leave a comment:


  • SteveRiley
    replied
    Originally posted by Feathers McGraw View Post
    Having your own email server is brilliant, my favourite part is being able to have loads of aliases (like ubuntu@samhobbs.co.uk) that map to a single account
    Simpler: use Postfix's address extension character, which by default is the plus sign.

    Say your account is alice@baz.org. You might consider using sign-up emails like:

    * alice+linkedin@baz.org
    * alice+facebook@baz.org
    * alice+canukpharm@baz.org

    When Postfix receives incoming mail, it ignores everything from the + up to the @. All it asks is, "Does alice@baz.org" live here?" If the answer is yes, Postfix accepts the message and invokes the delivery agent.

    Now it's Dovecot's turn to handle. If you have IMAP folders underneath your Inbox, then Dovecot will place incoming messages according to the address extension. Mail sent to alice+facebook@baz.org will get placed into the facebook folder. Depending on how Dovecot is configured, if this folder doesn't exist, Dovecot will create it for you automatically. iRedMail configures Dovecot to create nonexistent folders. Ubuntu's mail-stack-delivery won't create folders; if you don't manually create them, Dovecot delivers to Inbox.

    The cool thing about address extensions is that you don't need to write any Sieve scripts to move mail into folders.
    Last edited by SteveRiley; Nov 26, 2013, 01:58 AM.

    Leave a comment:


  • SteveRiley
    replied
    Originally posted by GreyGeek View Post
    So, if I read you right, I can set up my laptop, or another computer here at home, purchased a domain name and register it with Dyn, who will then give me an IP address (static?) and DNS connections, bypassing my ISP email service or gmail?
    Nope, they won't give you an IP address -- that comes from your ISP. Most home and small-biz routers have a mechanism for updating your "A" record at Dyn whenever your public IP address changes. Here's how I do it on my router, a Cisco RV-220W:

    Leave a comment:


  • Feathers McGraw
    replied
    You're very welcome, most of what I've learned I've read here or on similar sites, I feel I owe a lot back. It's rare I can be very helpful, everyone here knows so much!

    Feathers

    Leave a comment:


  • GreyGeek
    replied
    Originally posted by Feathers McGraw View Post
    .....

    Having your own email server is brilliant, my favourite part is being able to have loads of aliases (like ubuntu@samhobbs.co.uk) that map to a single account, so that if a company sells or leaks your email address to spammers you
    a) know who it is and can complain/let them know
    b) delete the alias without deleting your whole account

    Feathers
    Thanks, Feathers!
    Using Pi and letting it run 24/7 is great. Thanks for the info! Even though I programmed for forty years and worked with networking using Novell's stuff in the mid 1980s, this is one area of computers and networking I never got into.

    Leave a comment:


  • Feathers McGraw
    replied
    Originally posted by GreyGeek View Post
    I've purchased a domain name (jlkreps.net) around 2000 and my last activity was in Aug of 2004. It was to put my wife's geneology on for a few years so her family could generate the family tree and link everyone up. When I dropped it porn makers picked it up and I started getting complaints from friends that I was pushing porn! http://www.plotip.com/domain/jlkreps.net Somebody else registered it in 2008.

    Buying the domain name I still couldn't use it until I bought a hosting service and their DNS service. They set up a server with my domain name on it and set up the DNS also.

    So, if I read you right, I can set up my laptop, or another computer here at home, purchased a domain name and register it with Dyn, who will then give me an IP address (static?) and DNS connections, bypassing my ISP email service or gmail?
    That's hilarious (but annoying for you). Do you know if that's something that spammers do often?

    Whether or not your IP is static depends on your ISP. However, if you have a dynamic IP address then Dyn (or namecheap / most other DNS providers) have a service that will keep your domain name pointed at the right IP address even when your ISP changes it. This is called Dynamic DNS, and with namecheap it's free with the domain name. As I understand it, you run a DNS client on whichever computer is your server, and it calls out to your Dynamic DNS provider every now and then. If the Dynamic DNS provider receives a call and the IP address has changed then it will update the MX record to point to the new IP.

    My IP is now static so I don't need it, but for a while it was dynamic and I was using Namecheap's DynDNS options:

    Click image for larger version

Name:	dynamic_dns.jpg
Views:	1
Size:	35.5 KB
ID:	640474

    Remember, your laptop or other computer needs to be always on in order to receive emails, or some of them will bounce. If you're looking to do this then consider getting a Raspberry Pi - they're perfect for this kind of thing because of their low cost and power consumption. The standard distribution on the Pi is Raspbian, which is based on Debian and is very similar to Ubuntu in terms of file system, package manager etc. so it has the benefit of being easy to use!

    Having your own email server is brilliant, my favourite part is being able to have loads of aliases (like ubuntu@samhobbs.co.uk) that map to a single account, so that if a company sells or leaks your email address to spammers you
    a) know who it is and can complain/let them know
    b) delete the alias without deleting your whole account

    Feathers

    Leave a comment:


  • GreyGeek
    replied
    Originally posted by SteveRiley View Post
    .... I use Dyn as the registrar for my domain...
    I've purchased a domain name (jlkreps.net) around 2000 and my last activity was in Aug of 2004. It was to put my wife's geneology on for a few years so her family could generate the family tree and link everyone up. When I dropped it porn makers picked it up and I started getting complaints from friends that I was pushing porn! http://www.plotip.com/domain/jlkreps.net Somebody else registered it in 2008.

    Buying the domain name I still couldn't use it until I bought a hosting service and their DNS service. They set up a server with my domain name on it and set up the DNS also.

    So, if I read you right, I can set up my laptop, or another computer here at home, purchased a domain name and register it with Dyn, who will then give me an IP address (static?) and DNS connections, bypassing my ISP email service or gmail?

    Leave a comment:


  • Feathers McGraw
    replied
    Steve,

    Thank you so much for taking the time to write such an informative post, it's just what I was after!

    Definitely still learning! Not sure I'll ever stop, there's so much to know and it's so enjoyable making constant progress.

    Feathers

    Leave a comment:


  • SteveRiley
    replied
    If your ISP will not allow inbound connections from the Internet to your machine on destination port 25/tcp, then you have no choice but to sign up with a mail relay service. I use Dyn as the registrar for my domain, for relaying outbound mail so that its source is not from a dynamic IP pool, and for accepting inbound email as a gateway for my domain.

    When someone sends me email, the sender's mail service will query DNS for the MX record associated with my domain. Let's use dig to find out what that might be:
    Code:
    steve@t520:~$ [B]dig rileyz.net mx[/B]
    
    ; <<>> DiG 9.9.2-P1 <<>> rileyz.net mx
    ;; global options: +cmd
    ;; Got answer:
    ;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 39525
    ;; flags: qr rd ra; QUERY: 1, ANSWER: 2, AUTHORITY: 4, ADDITIONAL: 5
    
    ;; OPT PSEUDOSECTION:
    ; EDNS: version: 0, flags:; udp: 4096
    ;; QUESTION SECTION:
    ;rileyz.net.                    IN      MX
    
    ;; ANSWER SECTION:
    rileyz.net.             60      IN      MX      20 mx2.mailhop.org.
    rileyz.net.             60      IN      MX      10 mx1.mailhop.org.
    The answer is mx{1|2}.mailhop.org. These are Dyn's incoming relay servers. The sender's email will be accepted by one of these.

    Next, I've configured Dyn's email gateway service to relay incoming messages to my server and to port 2525/tcp:



    I've configured an A record for my domain because that's also the name of the server; I don't need any "www." or "mail." or whatever:



    When Dyn's email gateway resolves the IP address of my destination mail server, the answer is the A record above. Then Dyn's email gateway opens a socket to mail-server-ip:2525/tcp and begins the SMTP conversation to deliver my mail.

    The router behind my cable modem has a rule to forward inbound traffic with destination port 2525/tcp to my Debian 7 server, where Postfix is listening for such inbound connections:
    Code:
    root@m92p:~# [B]cat /etc/postfix/master.cf[/B]
    # =====================================================================
    # service type  private unpriv  chroot  wakeup  maxproc command + args
    #               (yes)   (yes)   (yes)   (never) (100)
    # =====================================================================
    #smtp      inet  n       -       -       -       -       smtpd
    2525       inet  n       -       -       -       -       smtpd
    submission inet  n       -       -       -       -       smtpd
     -o syslog_name=postfix/submission
     -o smtpd_tls_security_level=encrypt
     -o smtpd_sasl_auth_enable=yes
     -o smtpd_client_restrictions=permit_sasl_authenticated,reject
     -o milter_macro_daemon_name=ORIGINATING
    ...
    You'll notice that Postfix is also listening on 587/tcp, the submission port. That's for when I send outbound mail. My mail clients are configured to send outbound mail via my server, so no matter where I happen to be, outbound mail delivery begins with an inbound connection to my server. My router has a rule that forwards inbound traffic with destination port 587/tcp to the server. The client authenticates and then delivers the outbound mail to my server.

    Next, the server relays that outbound mail to Dyn:
    Code:
    root@m92p:~# [B]cat /etc/postfix/main.cf[/B]
    ...
    relayhost = outbound.mailhop.org:2525
    smtp_sasl_auth_enable = yes
    smtp_sasl_security_options =
    smtp_sasl_password_maps = hash:/etc/postfix/smtp_sasl_password_map
    ...
    Dyn's relay servers listen for mail on 25/tcp, 2525/tcp, and 10025/tcp. To keep beneath the Comcast radar, I choose 2525/tcp. (The only reason I used 2525/tcp on my own server for inbound mail relayed by Dyn was to keep my brain from melting. They don't really have to match.)

    The file /etc/postfix/smtp_sasl_password_map contains my user ID and password for the Dyn service. When my mail server relays outbound mail to Dyn, it must authenticate.


    As you are no doubt learning, email can be one of the thorniest things to get running. I admire your persistence...keep learning!

    Leave a comment:


  • Feathers McGraw
    replied
    Originally posted by tek_heretik View Post
    @Feathers...I know you are smart, I didn't mean to offend, just throwing a few thoughts out there, after all, this is over and above the usual Kubuntu questions, not that there is anything wrong with that, love your profile pic btw.
    Sorry if I over-reacted

    Glad you know who the character is! Was surprised nobody was using it already, there can't be that many penguins on TV. Apart from real ones.

    Wallace & Gromit is well known over here, but I know when they made a couple of the recent films they had to change a lot of jokes for the US version because only Brits found them funny... lol. I wonder which version you got in Canada? And how well it was received?

    Yeah the mail server is a little off topic but luckily Raspbian and Kubuntu are pretty similar to configure.

    Feathers

    Leave a comment:


  • tek_heretik
    replied
    @Feathers...I know you are smart, I didn't mean to offend, just throwing a few thoughts out there, after all, this is over and above the usual Kubuntu questions, not that there is anything wrong with that, love your profile pic btw.

    Leave a comment:


  • Robtygart
    replied
    Nmap is just a port scanner with extras too.. It will not hurt anything.

    Leave a comment:

Users Viewing This Topic

Collapse

There are 0 users viewing this topic.

Working...
X