Skip to content

feat: add --attachment flag to mail drafts create and mail send #10

Description

@okuegow

Problem

mog mail drafts create and mog mail send currently only accept --to, --subject, --body/--body-file. There is no way to attach a local file (PDF, image, etc.) when composing.

For invoicing/customer workflows where a signed contract PDF should travel with the email, users have to fall back to attaching manually in Outlook after the draft is created — which defeats the point of scripting the draft via mog.

Proposed solution

Add a repeatable --attachment <path> flag to both mail drafts create and mail send. Under the hood this maps to Microsoft Graph's POST /me/messages/{id}/attachments (file attachments under 3 MB) and the upload-session variant for larger files.

mog mail drafts create \
  --to a@example.com \
  --subject "Hi" \
  --body-file mail.txt \
  --attachment ./contract.pdf \
  --attachment ./annex.pdf

Notes

  • Graph distinguishes small (< 3 MB inline base64) vs. large (upload session) attachments — both should be handled transparently.
  • mail attachment list/download already exist, so the missing piece is an upload command. An mail attachment add <draft-id> <path> subcommand would also work as a lower-level primitive.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions