패키지, 저장소 및 앱 카테고리 검색

패키지 상세v3.0.3

flutter_mailer

기기로 이메일 공유 이메일 - 클라이언트는 여러 첨부 파일을 지원합니다

AndroidiOS
30일 다운로드
2.9만
좋아요
92
Pub 점수
160

패키지 설치

flutter pub add flutter_mailer

패키지 개요

공개 정보를 바탕으로 생성한 선택 가이드입니다.

Flutter Mailer는 사용자가 앱에서 디바이스의 기본 이메일 클라이언트로 직접 이메일을 공유할 수 있도록 해주는 Flutter 패키지입니다. 여러 첨부 파일을 포함한 이메일 전송을 지원하여 문서, 이미지 또는 기타 파일 공유에 적합합니다. 이 패키지는 Android 및 iOS 플랫폼과 원활하게 통합되며, 네이티브 이메일 인텐트를 활용하여 호환성과 신뢰성을 보장합니다. 미리 지정된 수신자, 제목, 본문 및 첨부 파일로 이메일 작성 화면을 시작하는 과정을 단순화합니다.

사용 사례

  • 앱 내에서 문서 공유하기
  • 첨부 파일이 있는 지원 티켓 보내기
  • 보고서 또는 영수증 배포
  • 이메일을 통한 사용자 피드백 활성화
  • 앱에서 이메일 워크플로우 자동화

주요 기능

  • 여러 파일 첨부를 지원합니다
  • Android 및 iOS에서 네이티브 이메일 클라이언트 사용
  • 이메일 작성용 간단한 API
  • 크로스 플랫폼 호환성
  • 사용자 정의 가능한 이메일 필드(수신자, 제목, 본문)

적합한 대상

  • 이메일 공유 기능이 필요한 앱
  • 문서 기반 응용 프로그램
  • 고객 지원 통합
  • 보고 또는 분석 도구
  • 사용자 생성 콘텐츠 배포

고려 사항

  • 사용자의 기본 이메일 클라이언트에 의존합니다
  • 사용자 상호작용 없이 직접 이메일을 보내지 않습니다
  • 첨부 파일 크기 제한은 장치 및 운영 체제에 따라 다릅니다
  • 일부 장치에서는 적절한 권한이 필요합니다
  • 이메일 작성 방식은 플랫폼에 따라 약간 다를 수 있습니다

원본 README

연결된 소스 저장소의 README 원문 스냅샷입니다. 최신 내용은 저장소에서 확인하세요.

flutter_mailer

pub package

Share email content via device Email Client - supports multiple Attachments

Simple & quick plugin for cross application data sharing of email fields in mobile development.

Flutter Mailer example app

Supports:

  • [x] android
  • [x] ios

Getting Started

Add to your pubspec dependencies, like so:

dependencies:
  flutter:
    sdk: flutter
  flutter_mailer: ^3.0.0

Instantiate mail options as follows:

send email
import 'package:flutter_mailer/flutter_mailer.dart';

...
...

final MailOptions mailOptions = MailOptions(
  body: 'a long body for the email <br> with a subset of HTML',
  subject: 'the Email Subject',
  recipients: ['example@example.com'],
  isHTML: true,
  bccRecipients: ['other@example.com'],
  ccRecipients: ['third@example.com'],
  attachments: [ 'path/to/image.png', ],
);

final MailerResponse response = await FlutterMailer.send(mailOptions);
switch (response) {
  case MailerResponse.saved: /// ios only
    platformResponse = 'mail was saved to draft';
    break;
  case MailerResponse.sent: /// ios only
    platformResponse = 'mail was sent';
    break;
  case MailerResponse.cancelled: /// ios only
    platformResponse = 'mail was cancelled';
    break;
  case MailerResponse.android:
    platformResponse = 'intent was successful';
    break;
  default:
    platformResponse = 'unknown';
    break;
}

note gmail and other apps Might parse HTML out of the body.

[Android] check if app is installed.

use full if you want to send the intent to a specific App. returns false on [IOS]

const GMAIL_SCHEMA = 'com.google.android.gm';

final bool gmailinstalled =  await FlutterMailer.isAppInstalled(GMAIL_SCHEMA);

if(gmailinstalled) {
  final MailOptions mailOptions = MailOptions(
    body: 'a long body for the email <br> with a subset of HTML',
    subject: 'the Email Subject',
    recipients: ['example@example.com'],
    isHTML: true,
    bccRecipients: ['other@example.com'],
    ccRecipients: ['third@example.com'],
    attachments: [ 'path/to/image.png', ],
    appSchema: GMAIL_SCHEMA,
  );
  await FlutterMailer.send(mailOptions);
}

[IOS] check if device has the ability to send email

this package uses MFMailComposeViewController for [IOS] which requires the default mail App. if none is installed you might want to revert to use url_launcher returns false on [Android]


  final bool canSend = await FlutterMailer.canSendMail();

  if(!canSend && Platform.isIos) {
    final url = 'mailto:$recipient?body=$body&subject=$subject';
    if (await canLaunch(url)) {
      await launch(url);
    } else {
      throw 'Could not launch $url';
    }
  }
}

For help getting started with Flutter, view official online documentation.

For help on editing plugin code, view the documentation.

based off of react-native-mail

카테고리

소스 저장소

이 패키지를 사용하는 프로젝트