encode method

String encode()

Encodes this mail address

Compare MailAddress.parse to decode an address

Implementation

String encode() {
  final personalName = this.personalName;
  if (personalName == null || hasNoPersonalName) {
    return email;
  }
  final buffer = StringBuffer()
    ..write('"')
    ..write(
      MailCodec.quotedPrintable.encodeHeader(
        personalName.trim(),
        fromStart: true,
      ),
    )
    ..write('" <')
    ..write(email)
    ..write('>');

  return buffer.toString();
}