summaryrefslogtreecommitdiffstats
path: root/bin/domain/imag-mail/src/config.rs
diff options
context:
space:
mode:
authorMatthias Beyer <mail@beyermatthias.de>2020-04-25 11:19:26 +0200
committerMatthias Beyer <mail@beyermatthias.de>2020-06-01 14:01:39 +0200
commitdc56e71afea2af8f107d04a6822bb517795ca480 (patch)
tree257d3a3634405460fab5c884066da703a8d08062 /bin/domain/imag-mail/src/config.rs
parent70f974ee7ab1d15a200d625878bd8b7db861bb98 (diff)
Add configuration for sending and receiving mail
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
Diffstat (limited to 'bin/domain/imag-mail/src/config.rs')
-rw-r--r--bin/domain/imag-mail/src/config.rs127
1 files changed, 127 insertions, 0 deletions
diff --git a/bin/domain/imag-mail/src/config.rs b/bin/domain/imag-mail/src/config.rs
index a7a991d7..aaa47013 100644
--- a/bin/domain/imag-mail/src/config.rs
+++ b/bin/domain/imag-mail/src/config.rs
@@ -52,6 +52,133 @@ pub struct MailConfig {
#[serde(rename = "from_address")]
from_address: String,
+ /// The location where the mail is stored after it is written, but before it is sent.
+ ///
+ /// This is where imag puts the mail, intended to be send at some point.
+ /// The mail-send-script should pick up each mail in here and process it.
+ /// Not to be confused with "drafts" which are not intended for sending yet.
+ #[serde(rename = "outgoing_maildir")]
+ outgoing_maildir: PathBuf,
+
+ /// Path script to run before writing outgoing mail to outgoing_maildir (optional)
+ #[serde(rename = "pre_outgoing")]
+ pre_outgoing: Option<PathBuf>,
+
+ /// Path script to run after writing outgoing mail to outgoing_maildir (optional)
+ #[serde(rename = "post_outgoing")]
+ post_outgoing: Option<PathBuf>,
+
+ /// The location where to put drafted mails
+ #[serde(rename = "draft_maildir")]
+ draft_maildir: PathBuf,
+
+ /// Path script to run before writing draft mail to draft_maildir (optional)
+ #[serde(rename = "pre_draft")]
+ pre_draft: Option<PathBuf>,
+
+ /// Path script to run after writing draft mail to draft_maildir (optional)
+ #[serde(rename = "post_draft")]
+ post_draft: Option<PathBuf>,
+
+ /// The location where to put sent mails
+ #[serde(rename = "sent_maildir")]
+ sent_maildir: PathBuf,
+
+ /// Path script to run before writing mail to sent_maildir (optional)
+ #[serde(rename = "pre_sent")]
+ pre_sent: Option<PathBuf>,
+
+ /// Path script to run after writing mail to sent_maildir (optional)
+ #[serde(rename = "post_sent")]
+ post_sent: Option<PathBuf>,
+
+
+ //
+ // Receive-config
+ //
+
+ /// Path to script to receive email
+ ///
+ /// Script should output absolute pathes to emails linewise
+ ///
+ /// STDERR of the script is logged by imag.
+ #[serde(rename = "recv_script")]
+ recv_script: PathBuf,
+
+ /// Whether to show output for each mail
+ recv_output: bool,
+
+ /// Output format for each mail
+ recv_output_format: Option<String>,
+
+ /// Whether to show summary output after receiving
+ recv_output_summary: bool,
+
+ /// Summary output format after receiving
+ recv_output_summary_format: Option<String>,
+
+ /// Script to be invoked before recving. (optional)
+ ///
+ /// STDERR of the script is logged by imag.
+ #[serde(rename = "pre_recv_script")]
+ pre_recv_script: Option<PathBuf>,
+
+ /// Script to be invoked after recving. (optional)
+ ///
+ /// STDERR of the script is logged by imag.
+ #[serde(rename = "post_recv_script")]
+ post_recv_script: Option<PathBuf>,
+
+ /// Whether to automatically import new emails
+ #[serde(rename = "auto_import")]
+ auto_import: bool,
+
+ //
+ // Send config
+ //
+
+ /// Path to script to send email
+ ///
+ /// The script gets the pathes to the email file on stdin.
+ /// This script is called once for each mail.
+ ///
+ /// If the script exits with a nonzero exit code, the sending is expected to be failed. The mail
+ /// is not considered sent.
+ ///
+ /// The script is expected to not alter the mails and not move them.
+ ///
+ /// STDERR of the script is logged by imag.
+ #[serde(rename = "send_script")]
+ send_script: PathBuf,
+
+ /// Whether to show a progress bar when sending
+ send_progress: bool,
+
+ /// If false, the invokation of the send scripts are chained. If one fails, the chain is
+ /// aborted.
+ ///
+ /// If true, the script is invoked in parallel for all mails. If one fails, the others are still
+ /// running.
+ #[serde(rename = "send_parallel")]
+ send_parallel: bool,
+
+ /// Script to be invoked before sending. (optional)
+ ///
+ /// Invoked exactly the same as the send_script (once for each mail, either in parallel or in
+ /// sequence). If this exits with a nonzero exit code, the send_script is not invoked. The
+ /// operation is aborted in case of sequencial sending.
+ ///
+ /// STDERR of the script is logged by imag.
+ #[serde(rename = "pre_send_script")]
+ pre_send_script: Option<PathBuf>,
+
+ /// Script to be invoked after sending. (optional)
+ ///
+ /// Exit code ignored.
+ ///
+ /// STDERR of the script is logged by imag.
+ #[serde(rename = "post_send_script")]
+ post_send_script: Option<PathBuf>,
}
impl MailConfig {