sanitizedName property

String? sanitizedName

The name used to output to SMTP server. Implementation can override it to pre-process the name before sending. For example, providing a default name for certain address, or quoting it.

Implementation

String? get sanitizedName {
  if (name == null) return null;

  // Quote the name if it contains a comma or a quote.
  if (name!.contains(_quotableNameRegExp)) {
    return '"${name!.replaceAll('"', r'\"')}"';
  }

  return name;
}