Well yes and no.  I actually want to KEEP the "name", not parse out
just the address.   And actually the data is more complicated than what
I posted because I wanted to focus on one issue.  The problem is that
the app (written by someone else) allows them to (a) type in email
addresses freehand, and/or (b) select them from a list of frequent emails
that sometimes have a name and sometimes do not.  So for example,
my string can have values like below.  I need to extract individual addresses
and they want me to keep the "name".  This wasn't an issue in RMail for
7.6 because we sent them all on one line, but the newer RMail requires
each address on a different line.  I might suggest that we totally redo the
method of them selecting an address.  We can't upgrade until I have RMail
code redone so I have some time to wrestle with this.

        [email protected]
        [email protected], [email protected]
        "karen tellef" <[email protected]>
        "karen tellef" <[email protected]>, [email protected]

 
Nice data, huh??   I need to be off the allergic meds to tackle this one!

Karen


 

 

-----Original Message-----
From: Buddy Walker <[email protected]>
To: karentellef <[email protected]>
Sent: Thu, Oct 22, 2015 6:34 pm
Subject: [RBASE-L] - RE: Help with parsing email addresses?



Karen 
  Could you try something like this it should work with or without the comma
 
************************
SET VAR vLen INTEGER = 0
SET VAR vLoc INTEGER = 0
SET VAR vRem INTEGER = 0
SET VAR vEMail TEXT = NULL
SET VAR vEmail1 TEXT = NULL
--SET VAR vEMail1 = ('tellef, karen <[email protected]>')
SET VAR vEMail1 = ('karen tellef <[email protected]>')
 
IF vEMail1 CONTAINS '<' THEN
  SET VAR vLen = (SLEN(vEMail1))
  SET VAR vLoc = (SLOC(.vEmail1,'<'))
  SET VAR vRem = (.vLen - .vLoc)
  SET VAR vEMail = (SGET(.vEMail1,(.vRem -1),(.vLoc +1)))
ENDIF
 
SHOW VAR vEMail
****************************
 
Buddy
 
 
From: [email protected] [mailto:[email protected]] On Behalf Of Karen Tellef
Sent: Thursday, October 22, 2015 12:45 PM
To: Richardson, Jeff <[email protected]>
Subject: [RBASE-L] - Help with parsing email addresses?
 
Converting older RMail code into new RMail code.  One of the things I have to 
do is parse email addresses into individual RMail commands.  I have no real 
control over how it's getting to me.

If all data was like this, I could obviously parse using SSUB:
    [email protected], [email protected]

Some of the data comes in with the "names" as part of the address.  Again, this 
would be easy, use SSUB
    karen tellef <[email protected]>, mary smith <[email protected]

But guess what...  Some of the names actually have a comma embedded:
    tellef, karen <[email protected]>, mary Smith <[email protected]>


Sigh...   Any suggestions on how I could program to get this into 2 lines for 
an RMail send?

Thanks much!

Karen


Reply via email to