Question: I managed to send an email from Flutter but only `<br>` is allowed in email message.
If I try even a `<b>` tag, it answers with status code of 400.

```
Future<Null> testingEmail(String userId, Map header) async {
  header['Accept'] = 'application/json';
  header['Content-type'] = 'application/json';

  var from = userId;
  var to = userId;
  var subject = 'test send email';
  var message = "Hi<br/>Html <b>Email</b><br><br>gfdgdfgdfg";
  var content = '''
    Content-Type: text/html; charset="utf-8"
    MIME-Version: 1.0
    Content-Transfer-Encoding: 7bit
    to: ${to}
    from: ${from}
    subject: ${subject}

    ${message}''';

  var bytes = utf8.encode(content);
  var base64 = base64Encode(bytes);
  var body = json.encode({'raw': base64});

  String url =
      'https://www.googleapis.com/gmail/v1/users/' + userId + '/messages/send';

  final http.Response response =
      await http.post(url, headers: header, body: body);
}

```

Answer: 
When building the string, be careful with the linebreaks. It's better to use `\n` to avoid issues and instead of using `base64Encode`, use `base64Url`. Here it's a little example that show the encoded body:

```
import 'dart:convert';

void main() {
  var content = '''Content-Type: text/html; charset=utf-8\nMIME-Version: 1.0\nContent-Transfer-Encoding: 7bit\nto: user2@domain\nsender: user@domain\nsubject: API test Dart\n\nHi<br/>Html <b>Email</b><br><br>gfdgdfgdfg''';

  String encoded = base64Url.encode(utf8.encode(content));
  print(encoded);

}

```

Also, I would recommend you to check the [Google API Client Libraries with Dart](https://github.com/dart-lang/googleapis), this is the official Dart's library provided by Google to use its APIs.
The simplest solution is probably to just use <https://pub.dev/packages/mailer>