1. Home
  2. Knowledge Base
  3. GMS
  4. Is it possible to single out an email address from the "To" header

Is it possible to single out an email address from the "To" header

Answer

The EMailTo variable usually displays single entries in the following format:

"User Name" <Username@domain.dom>

Which can be filtered by using the ConvertToEmailAddress() function or Left, Mid, etc. e.g.

ConvertedTo = ConvertToEmailAddress(EmailTo);

However, this does not work if there are multiple entries in the To clause.

"User Name1" <Username1@domain.dom>, "User Name2" <Username2@domain.dom>, etc..

To find all of the email addresses, the original script will need to be altered to test every entry.

NumberOfTo = LSLength(EMailTo, ",");

for(i = 1; i < NumberOfTo + 1; i = i + 1)
{
ConvertedTo = ConvertToEmailAddress(LSElement(EMailTo, i, ","));
}

This script finds each entry in the "To" clause by using the "," then convert this single element to an email address.

Keywords:Multiple, To, MML, single

Was this article helpful?

Related Articles

Contents

Need Support?

Can't find the answer you're looking for?
Contact Support