Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Adding Mutt subcommand

  • Loading branch information...
commit 20ed7a74d50308d02023709601ebea178d8cc849 1 parent 679cfc4
Stefan Schlesinger authored

Showing 2 changed files with 24 additions and 2 deletions. Show diff stats Hide diff stats

  1. +7 1 README.md
  2. +17 1 bin/smailr
8 README.md
Source Rendered
... ... @@ -1,4 +1,4 @@
1   -# Smailr - A Virtual Mail Hosting Management CLI (NOTE: STILL IN DEVELOPMENT)
  1 +# Smailr - A Virtual Mail Hosting Management CLI (BETA)
2 2
3 3 Smailr is a small CLI application, which lets you manage a typical Exim / Dovecot stack.
4 4
@@ -75,6 +75,12 @@ Simply add an 'user-alias@example.com' alias to the 'user@example.com' mailbox.
75 75
76 76 smailr add user@example.com --alias user-alias@example.com
77 77
  78 +### Mutt
  79 +
  80 +Smailr can launch mutt with the required configuration for a specific mailbox
  81 +automatically. Open mutt for the specified mailbox:
  82 +
  83 + smailr mutt user@example.com
78 84
79 85 ## BUGS
80 86
18 bin/smailr
@@ -69,7 +69,7 @@ end
69 69 command :rm do |c|
70 70 c.syntax = 'smailr rm domain | mailbox [options]'
71 71 c.summary = 'Remove a domain, mailbox or alias known to the mail system.'
72   - c.example 'Remove a domain', 'smailr rm ono.at'
  72 + c.example 'Remove a domain', 'smailr rm example.com'
73 73 c.option '--force', 'Force the operation, do not ask for confirmation.'
74 74 c.option '--alias STRING', String, 'Specify the alias which you want to remove.'
75 75 c.action do |args, options|
@@ -102,3 +102,19 @@ command :migrate do |c|
102 102 end
103 103 end
104 104 end
  105 +
  106 +command :mutt do |c|
  107 + c.syntax = "smailr mutt address"
  108 + c.summary = "View the mailbox of the specified address in mutt."
  109 + c.description = "Open the mailbox of the specified address in mutt.\n\n " +
  110 + "Requires that mutt is installed and assumes the default mail\n " +
  111 + "storage directory structure: /srv/mail/users/<fqdn>/<localpart>"
  112 + c.example 'Open test@example.com', 'smailr mutt test@example.com'
  113 + c.action do |args,options|
  114 + localpart, fqdn = args[0].split('@')
  115 + `command -v mutt >/dev/null 2>&1 || { echo "Please install mutt first. Aborting." >&2; exit 1; }`
  116 + if not $?
  117 + exec "MAIL=/srv/mail/users/#{fqdn}/#{localpart} MAILDIR=$MAIL mutt -mMaildir]"
  118 + end
  119 + end
  120 +end

0 comments on commit 20ed7a7

Please sign in to comment.
Something went wrong with that request. Please try again.