Skip to content
Browse files

Adding Mutt subcommand

  • Loading branch information...
1 parent 679cfc4 commit 20ed7a74d50308d02023709601ebea178d8cc849 @sts committed Apr 28, 2012
Showing with 24 additions and 2 deletions.
  1. +7 −1 README.md
  2. +17 −1 bin/smailr
View
8 README.md
@@ -1,4 +1,4 @@
-# Smailr - A Virtual Mail Hosting Management CLI (NOTE: STILL IN DEVELOPMENT)
+# Smailr - A Virtual Mail Hosting Management CLI (BETA)
Smailr is a small CLI application, which lets you manage a typical Exim / Dovecot stack.
@@ -75,6 +75,12 @@ Simply add an 'user-alias@example.com' alias to the 'user@example.com' mailbox.
smailr add user@example.com --alias user-alias@example.com
+### Mutt
+
+Smailr can launch mutt with the required configuration for a specific mailbox
+automatically. Open mutt for the specified mailbox:
+
+ smailr mutt user@example.com
## BUGS
View
18 bin/smailr
@@ -69,7 +69,7 @@ end
command :rm do |c|
c.syntax = 'smailr rm domain | mailbox [options]'
c.summary = 'Remove a domain, mailbox or alias known to the mail system.'
- c.example 'Remove a domain', 'smailr rm ono.at'
+ c.example 'Remove a domain', 'smailr rm example.com'
c.option '--force', 'Force the operation, do not ask for confirmation.'
c.option '--alias STRING', String, 'Specify the alias which you want to remove.'
c.action do |args, options|
@@ -102,3 +102,19 @@ command :migrate do |c|
end
end
end
+
+command :mutt do |c|
+ c.syntax = "smailr mutt address"
+ c.summary = "View the mailbox of the specified address in mutt."
+ c.description = "Open the mailbox of the specified address in mutt.\n\n " +
+ "Requires that mutt is installed and assumes the default mail\n " +
+ "storage directory structure: /srv/mail/users/<fqdn>/<localpart>"
+ c.example 'Open test@example.com', 'smailr mutt test@example.com'
+ c.action do |args,options|
+ localpart, fqdn = args[0].split('@')
+ `command -v mutt >/dev/null 2>&1 || { echo "Please install mutt first. Aborting." >&2; exit 1; }`
+ if not $?
+ exec "MAIL=/srv/mail/users/#{fqdn}/#{localpart} MAILDIR=$MAIL mutt -mMaildir]"
+ end
+ end
+end

0 comments on commit 20ed7a7

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