Alaska Software Inc. - Verificar sintaxis de correos
Username: Password:
AuthorTopic: Verificar sintaxis de correos
Osvaldo Ramirez Verificar sintaxis de correos
on Wed, 16 May 2007 22:51:52 -0600
Hola,

Este es una funcion que revisa las sintaxis de los correos


cMail := "V<xxx@xxx.com,<xxx@xxx.com>,asdf@xxxx.com",

return := "V<xxx@xxx.com>,XXX<xxx@xxx.com>,asdf<asdf@xxxx.com>"


function ChkeMailSintaxis( cMail )
* begin
   local i
   local nToken
   local aMails := {}

   cMail := alltrim( cMail )
   if ! empty( cMail )
      nToken := numtoken( cMail,"," )

      if nToken = 0
         aadd( aMails , cMail )
      else
         for i := 1 to ntoken
           aadd( aMails , token(cMail,",",i))
         next
      endif

      for i := 1 to len( aMails )
          Ahora lo dejamos solo con sus brackets
         cMail := aMails[i]
         cName := ""

         if (nPos := at("<",cMail)) > 0
            if nPos > 2  Tiene Nombre
               cName := substr(cMail,1,nPos-1)
            endif
            cMail := substr(cMail,nPos+1)
         endif
         cMail := strtran(strtran(cMail,"<",""),">","")

         if (nPos := at("@",cMail)) > 0
           if empty( cName )
              cName := substr( cMail,1,nPos-1)
           endif
           aMails[i] := cName+"<"+cMail+">"
         else
           aMails[i] := ""
         endif
      next
      cMails := ""
      for i := 1 to len( aMails )
         if ! empty( aMails[i] )
            cMails += aMails[i]+","
         endif
      next
      if substr(cMails,len(cMails),1) = ","
         cMails := substr( cMails,1,len(cMails)-1)
      endif

   endif

return cMail


La pongo para que les sirva y si puden mejorarla la ponemos aqui.

Saludos
Osvaldo Ramirez