imappipe [options] server:port
Poll an IMAP mailbox and write the messages to standard output.
go install codeberg.org/msantos/imappipe@latest
# to build from the git repository
CGO_ENABLED=0 go build -trimpath -ldflags "-w"
imappipe --username=user@example.com --password=example \
mail.example.com:993
mailbox string : IMAP mailbox (default "INBOX")
password string : IMAP password
poll-timeout duration : Set poll interval if IDLE not supported
template string : message template
username string : IMAP username
verbose int : Enable debug messages
no-tls bool : Disable connecting to the IMAP port using TLS
IMAPPIPE_USERNAME : Set default username
IMAPPIPE_PASSWORD : Set default password
See the default template.
A message consists of the following fields:
Date : The time in RFC3339 format when the message was retrieved.
Header : Message headers. See Header.
Body : The list of message bodies.
Attachment : The list of files attached to the message. See Attachment.
From : The list of "from" addresses.
To : The list of "to" addresses.
Date : The message header date.
Subject : The message header subject.
Map : A map containing all the message headers.
Name : File name
Content : File content
Concatenate an array of strings using the provided string.
From: {{ .Header.From | join ", " }}
Match a message field using a regular expression.
{{ if re .Header.Subject "foo" -}}
{{- range $v := .Body }}
{{ $v }}
{{- end }}
{{- end }}
Remove any HTML elements from a message field.
{{ .Body | join "\n" | strip }}
{{- $allow := false -}}
{{- range $v := .Header.From -}}
{{- if re $v "(?i)<user@example.com>" -}}
{{- $allow = true -}}
{{- end -}}
{{- end -}}
{{- if $allow }}
--- {{ .Date }}
From: {{ .Header.From | join ", " }}
Subject: {{ .Header.Subject | strip }}
Date: {{ .Header.Date }}
{{ .Body | join "\n" | strip }}
---
{{- end }}