SwiftUIMailView - MailView allows you to send mail from SwiftUI

Overview

SwiftUIMailView

The MailView allows you to send mail from SwiftUI. You can:

  • Determine if you can send mail or not.
  • Pass subject, message and recipients to the view via a binding.
  • Attach files to the email.
  • Receive success or failure result after sending the email.

The end result looks like this:

in action

Recipe

Check out this recipe for in-depth description of the component and its code. Check out SwiftUIRecipes.com for more SwiftUI recipes!

Sample usage

struct MailViewTest: View {
   @State private var mailData = ComposeMailData(subject: "A subject",
                                                 recipients: ["[email protected]"],
                                                 message: "Here's a message",
                                                 attachments: [AttachmentData(data: "Some text".data(using: .utf8)!,
                                                                              mimeType: "text/plain",
                                                                              fileName: "text.txt")
                                                 ])
   @State private var showMailView = false

    var body: some View {
        Button(action: {
            showMailView.toggle()
        }) {
            Text("Send mail")
        }
        .disabled(!MailView.canSendMail)
        .sheet(isPresented: $showMailView) {
            MailView(data: $mailData) { result in
                print(result)
            }
        }
    }
}

Installation

This component is distrubuted as a Swift package.

You might also like...
A SwiftUI iOS App and Vapor Server to send push notifications fueled by Siri Shortcuts.
A SwiftUI iOS App and Vapor Server to send push notifications fueled by Siri Shortcuts.

Puffery An iOS App written in SwiftUI to send push notifications fueled by Siri Shortcuts. You can follow other's channels and directly receive update

PinpointKit is an open-source iOS library in Swift that lets your testers and users send feedback with annotated screenshots using a simple gesture.
PinpointKit is an open-source iOS library in Swift that lets your testers and users send feedback with annotated screenshots using a simple gesture.

PinpointKit is an open-source iOS library in Swift that lets your testers and users send feedback with annotated screenshots using a simple gesture. F

Apps for translating Braille document captured by iPhone camera, then send translation result to ITS's Braille printer for duplicating purpose (re-printing, copying braille document with no original text)

SCANDO iOS On my Final Project (Thesis) for my Bachelor degree, I made an apps that translate Braille Document, and send the translation result to the

Convert the image to hexadecimal to send the image to e-paper

ConvertImageToHex Convert the image to hexadecimal to send the image to e-paper Conversion Order // 0. hex로 변환할 이미지 var image = UIImage(named: "sample

Library to send mock remote notifications to the iOS simulator
Library to send mock remote notifications to the iOS simulator

SimulatorRemoteNotifications SimulatorRemoteNotifications is a library to send mock remote notifications to the iOS simulator. The library extends UIA

To Practice UINavigationController, transition, ViewController Life Cycle, send data to different page, asset catalogs
To Practice UINavigationController, transition, ViewController Life Cycle, send data to different page, asset catalogs

LED Board Check Point ! StackView 여러개의 view 를 set 으로 만들어 주는 역활을 함 일정한 규칙에 따라서 stack view 안에 움직이는것임 이미지 넣기 프로젝트 내에 Assets 폴더 내에 Image Set 을 추가하여 1x, 2x

send your valuable codes here.

Hacktoberfest2021 # Hacktoberfest 2021 Hacktoberfest encourages participation in the open source community, which grows bigger every year. Complete th

Pic-To-Send iOS Application Repository
Pic-To-Send iOS Application Repository

PicToSend_G03_iOS_Project Pic-To-Send iOS Application Repository Application User Interface How to run the application: Pre-requisite: Xcode 13 or lat

RNH Tracker is a GPS logger for iOS (iPhone, iPad, iPod) Track your location and send your logs to RNH Regatta :-)

RNH Tracker for iOS + WatchOS RNH Tracker is a GPS logger for iOS (iPhone, iPad, iPod) with offline map cache support. Track your location, add waypoi

This to learn such as : Add Target , NSNotification Center Send/Get Data , Observer Override , resize Data By Byte , UIImagePicker Delegate , UIAlert Handle , Top ViewController , Get pickerController

Technicalisto How to Create UIButton Class to Pick Data Image Purpose Learn this topics With exact Task Add Target NSNotification Center Send/Get Data

Xgist - Xcode extension to send code to GitHub's Gist
Xgist - Xcode extension to send code to GitHub's Gist

Xgist Xgist is a Xcode extension to send code to GitHub's Gist. The extension will send your code selection to Gist and automatically copy the Gist UR

MultiPeer-Progress-iOS - Swift project to demo the use of the MultiPeer framework to send files between iOS devices and show the progress IOS Dracker Payment - An iOS and React app to send/receive money and manage debt
IOS Dracker Payment - An iOS and React app to send/receive money and manage debt

An iOS and React app to send/receive money and manage debt. This app allows users to create transactions, add descriptions, tag images, tag notes, and manage them.

This is a simple chat application made in Swift using send and receive interface.

Flash Chat 💁🏽‍♂️ Overview This is a simple chat application made in Swift using send and receive interface. ⚙️ How it works The user needs to first

Send key events to any running macOS application.

KeySender An extremely simple micro package that enables you to send key events to any running application. Install Add the following to your Package.

Send email to any SMTP server like a boss, in Swift and cross-platform
Send email to any SMTP server like a boss, in Swift and cross-platform

Hedwig is a Swift package which supplies a set of high level APIs to allow you sending email to an SMTP server easily. If you are planning to send ema

A decoupled TestRail integration for your Xcode project to easily send results to TestRail.
A decoupled TestRail integration for your Xcode project to easily send results to TestRail.

(Super Easy) Xcode TestRail Integration This integration helps you to automatically send test results to TestRail. And yes, super easy and simple! Add

RadarKit - The Radar Kit allowing you to locate places, trip neary by you Or it will help you to search out the people around you with the few lines of code Visualize your dividend growth. DivRise tracks dividend prices of your stocks, gives you in-depth information about dividend paying stocks like the next dividend date and allows you to log your monthly dividend income.
Visualize your dividend growth. DivRise tracks dividend prices of your stocks, gives you in-depth information about dividend paying stocks like the next dividend date and allows you to log your monthly dividend income.

DivRise DivRise is an iOS app written in Pure SwiftUI that tracks dividend prices of your stocks, gives you in-depth information about dividend paying

Comments
  • Set image size?

    Set image size?

    When I attach a large image (iOS screenshot), and then press send, it asks if I want to change the image size to make the email smaller.

    Question: Is there a way to programmatically set this to "medium" before the mail dialog is presented?

    Thanks for the excellent package, it works great.

    opened by svenyonson 1
Owner
Gordan Glavaš
Gordan Glavaš
MailCore 2 provide a simple and asynchronous API to work with e-mail protocols IMAP, POP and SMTP.

MailCore 2: Introduction MailCore 2 provides a simple and asynchronous Objective-C API to work with the e-mail protocols IMAP, POP and SMTP. The API h

MailCore 2.5k Jan 1, 2023
SwiftyEmail - A super simple Swift e-mail composer package

SwiftyEmail is a mini library for iOS, iPadOS and Mac Catalyst using MessageUI. With SwiftyEmail, you'll be able to send e-mails from your app calling your user's favorite e-mail app (including third party ones!).

Marcos Morais 5 Nov 20, 2022
Now playing controller from Apple Music, Mail & Podcasts Apple's apps.

SPStorkController About Controller as in Apple Music, Podcasts and Mail apps. Help if you need customize height or suppport modal style in iOS 12. Sim

Ivan Vorobei 2.6k Jan 4, 2023
iOS-mail — ProtonMail iOS client app

iOS-mail Introduction iOS-mail — ProtonMail iOS client app The app is intended for all users of the ProtonMail service. Whether they are paid or free,

null 1.2k Jan 3, 2023
TempBox - Instant disposable emails for Mac powered by Mail.tm

TempBox Instant disposable emails for Mac powered by Mail.tm Features Native Mac app Create multiple accounts Download message source Download Attachm

Waseem akram 217 Dec 30, 2022
MailCore 2 provide a simple and asynchronous API to work with e-mail protocols IMAP, POP and SMTP.

MailCore 2: Introduction MailCore 2 provides a simple and asynchronous Objective-C API to work with the e-mail protocols IMAP, POP and SMTP. The API h

MailCore 2.5k Jan 1, 2023
An easy-to-use UITableViewCell subclass that implements a swippable content view which exposes utility buttons (similar to iOS 7 Mail Application)

SWTableViewCell An easy-to-use UITableViewCell subclass that implements a swipeable content view which exposes utility buttons (similar to iOS 7 Mail

Christopher Wendel 7.2k Dec 31, 2022
Swipeable UITableViewCell/UICollectionViewCell based on the stock Mail.app, implemented in Swift.

SwipeCellKit Swipeable UITableViewCell/UICollectionViewCell based on the stock Mail.app, implemented in Swift. About A swipeable UITableViewCell or UI

null 6k Jan 7, 2023
SwiftyEmail - A super simple Swift e-mail composer package

SwiftyEmail is a mini library for iOS, iPadOS and Mac Catalyst using MessageUI. With SwiftyEmail, you'll be able to send e-mails from your app calling your user's favorite e-mail app (including third party ones!).

Marcos Morais 5 Nov 20, 2022
Logger lets you quickly send messages to yourself as a means of fast note taking

Logger Logger lets you quickly send messages to yourself as a means of fast note taking. All messages you send to yourself show up chronologically. Ta

Nathan Borror 53 Nov 16, 2022