mdsend

package module
v0.0.4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 7, 2024 License: MIT Imports: 19 Imported by: 0

README

Mdsend

Project status: ALPHA DRAFT

Send markdown files as MIME-encoded electronic mail.

Installation

  • Go:
    go install github.com/dkotik/mdsend@latest
    
  • Macintosh:
    brew tap dkotik/tap
    brew install mdsend
    

Example

---
subject: "Test Email"
to: "Test Account <test@gmail.com>"
to: "./localfile.yaml|toml|json|csv|txt"
---

# Title

Message body.

Easily hackable.

EmailSend(file.md, templating engine, provider engine)

Delivery Locking

Distributors

Planned Features

  • Text-part writer should minify html! minified html will have without quotes! (change inline detector)
  • Should write a better markdown renderer that recognizes single-line youtube and image paragraphs, centers them.
  • Email validation: https://github.com/reacherhq/check-if-email-exists

Tools

Documentation

Index

Constants

View Source
const Version = "dev"

Variables

This section is empty.

Functions

func MIMEBase64To

func MIMEBase64To(w io.Writer, r io.Reader) (err error)

func MIMEHeaderTo

func MIMEHeaderTo(w io.Writer, header textproto.MIMEHeader) (err error)

func PreviewMessage

func PreviewMessage(m *loaders.Message)

func RegisterCompressor

func RegisterCompressor(contentType string, resizer Compressor)

func Send

func Send(message *loaders.Message, o *Options) error

Send a message with default agents.

Types

type Attachment

type Attachment struct {
	Name   string
	Source string
	Hash   uint64 // for XXHash2
	// contains filtered or unexported fields
}

func NewAttachment

func NewAttachment(p string) (*Attachment, error)

func (*Attachment) WriteTo

func (a *Attachment) WriteTo(w io.Writer) (int64, error)

type Compressor

type Compressor func(io.Reader) (*bytes.Buffer, error)

func NewImageJPEGResizer

func NewImageJPEGResizer(maxWidth, maxHeight, quality uint) Compressor

type MIMELineWrapper

type MIMELineWrapper struct {
	// contains filtered or unexported fields
}

MIMELineWrapper writes everything to io.Writer chunked by maxMIMELineLen.

func (*MIMELineWrapper) Write

func (w *MIMELineWrapper) Write(p []byte) (int, error)

type Mailer

type Mailer struct {
}

type Message

type Message interface {
	To() []string
	CC() []string
	BCC() []string
	Subject() string
	MIMEBody() io.ReadCloser
}

type Option

type Option func(m *Mailer) error

func WithOptions

func WithOptions(options ...Option) Option

type Options

type Options struct {
	URI         string // Credentials for provider API backend.
	Verbose     bool
	Dryrun      bool // Run the program without delivering or locking anything down.
	YesOnPrompt bool // Automatically confirm all prompts.
	Logger      loggers.Logger
	Loader      loaders.Loader
	Renderer    renderers.Renderer
	Provider    providers.Provider
	Distributor distributors.Distributor
}

Options provide configuration to component execution.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL