MakeEmailAddress (open)

Generate a full email address containing name and email

Syntax

LOADLIB "wh::internet/mime.whlib";

STRING FUNCTION MakeEmailAddress(STRING name, STRING email, RECORD options)

Parameters

STRING name

An optional name for the address

STRING email

The email address

RECORD options

Options

BOOLEAN quote

If true, force the name to be quoted

Return value

STRING

A string with the full email address, or an empty string if no email was specified

Description

This function generates a full email address from the name and email address. With no name specified it will be just return the email address, If no email was specified it will return an empty string.

Examples

// Returns '"Jane Doe" <j.doe@example.net>'
STRING addr := MakeEmailAddress("Jane Doe", "j.doe@example.net", TRUE);

// Returns '<j.doe@example.net>'
STRING addr := MakeEmailAddress("", "j.doe@example.net", FALSE);

// Returns ""
STRING addr := MakeEmailAddress("Jane Doe", "", TRUE);