facebook twitter hatena line email

「Flutter/外部ライブラリ/メール送信/flutter mailer」の版間の差分

提供: 初心者エンジニアの簡易メモ
移動: 案内検索
行23: 行23:
 
       attachments: [ 'path/to/image.png', ],
 
       attachments: [ 'path/to/image.png', ],
 
     );
 
     );
 +
    await FlutterMailer.send(mailOptions);
 
</pre>
 
</pre>
  
    await FlutterMailer.send(mailOptions);
+
==エラーが出てしまう==
 +
<pre>
 +
~/android/app/src/debug/AndroidManifest.xml:22:18-91 Error:
 +
Attribute application@appComponentFactory value=(android.support.v4.app.CoreComponentFactory) from [com.android.support:support-compat:28.0.0] AndroidManifest.xml:22:18-91
 +
is also present at [androidx.core:core:1.0.2] AndroidManifest.xml:22:18-86 value=(androidx.core.app.CoreComponentFactory).
 +
Suggestion: add 'tools:replace="android:appComponentFactory"' to <application> element at AndroidManifest.xml:11:5-34:19 to override.
 +
<pre>

2019年12月5日 (木) 14:45時点における版

flutter_mailerとは

直でflutterからメール送信できるライブラリ

公式

https://pub.dev/packages/flutter_mailer

インストール

dependencies:
  flutter_mailer: ^0.4.1+1

サンプル

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', ],
    );
    await FlutterMailer.send(mailOptions);

エラーが出てしまう

~/android/app/src/debug/AndroidManifest.xml:22:18-91 Error:
	Attribute application@appComponentFactory value=(android.support.v4.app.CoreComponentFactory) from [com.android.support:support-compat:28.0.0] AndroidManifest.xml:22:18-91
	is also present at [androidx.core:core:1.0.2] AndroidManifest.xml:22:18-86 value=(androidx.core.app.CoreComponentFactory).
	Suggestion: add 'tools:replace="android:appComponentFactory"' to <application> element at AndroidManifest.xml:11:5-34:19 to override.
<pre>