Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Saving emails #30

Open
EtienneBruines opened this issue Jun 29, 2015 · 1 comment
Open

Saving emails #30

EtienneBruines opened this issue Jun 29, 2015 · 1 comment
Labels
Milestone

Comments

@EtienneBruines
Copy link
Collaborator

According to #29 I've implemented a way for our server to receive incoming emails from Postfix (SMTP server), using the LMTP protocol. This means we can serve actual emails to end-users.

What we receive from Postfix:

  • The sender (e-mail address)
  • The recipients (plural, and we can process them individually); meaning we can:
    • deny it for user A because we don't know him;
    • accept it for user B because we like him;
    • deny it for user C because his quota is reached;
    • accept it for user D because we like him too;
    • ... and the MTA (SMTP server) will be OK with that.
  • Raw message, i.e.:
Received: from there (localhost [IPv6:::1])
        by receiver.local (Postfix) with SMTP id EE9EB416D4
        for <[email protected]>; Mon, 29 Jun 2015 15:35:31 +0200 (CEST)
Message-Id: <[email protected]>
Date: Mon, 29 Jun 2015 15:35:31 +0200 (CEST)
From: [email protected]

hi there

We should probably have an interface that stores this information, so anyone can implement it any way they like. The message should go inside the "mailboxes" of the recipients, so we can eventually serve them to the end-users. Should we do any preprocessing? (such as timestamp, name of sender, name of receiver, optional subject, etc.) -- and if so, which attributes?

Or do we simply store the raw data somewhere?

Thoughts? @alienscience @waffle-iron (or anyone for that matter?)

@EtienneBruines EtienneBruines added this to the Version 0.1 milestone Jun 29, 2015
@alienscience
Copy link
Owner

The raw data should be saved - probably by calling the Mailstore which can then write it to a database or file system.

The message should have a 32bit IMAP uid assigned to it and also flags:

// Message flags
const (
    // The message has been read
    Seen = 1 << iota
    // The message has been answered
    Answered
    // The message has been flagged for urgent/special attention
    Flagged
    // The message has been marked for removal by EXPUNGE
    Deleted
    // The message is imcomplete and is being worked on
    Draft
    // The message has recently arrived in the mailbox
    Recent
)

var messageFlags = map[uint8]string{
    Seen:     `\Seen`,
    Answered: `\Answered`,
    Flagged:  `\Flagged`,
    Deleted:  `\Deleted`,
    Draft:    `\Draft`,
    Recent:   `\Recent`,
} 

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants