Ver Mensaje Individual
  #126 (permalink)  
Antiguo 17/09/2011, 06:04
DanielImago
 
Fecha de Ingreso: septiembre-2011
Mensajes: 8
Antigüedad: 13 años, 2 meses
Puntos: 0
Respuesta: Biblioteca de Clases,Funciones y Sub-rutinas.

Para quitar todo el HTML de un texto:

Function RemoveHTML(strText)
Dim RegEx
Set RegEx = New RegExp
RegEx.Pattern = "<[^>]*>"
RegEx.Global = True
strText = Replace(LCase(strText), "", chr(10))
RemoveHTML = RegEx.Replace(strText, "")
End Function


Para manejo de mails: (Muy util !!)

Function IsEmail(strEmail)
IsEmail = True
strLetrasPermitidas = "abcdefghijklmnopqrstuvwxyz1234567890._-@"
strEmail = Lcase(strEmail)

For t = 1 To Len(strEmail)
strLetra = Mid(strEmail, t, 1)
If Instr(strLetrasPermitidas, strLetra) = 0 Then
IsEmail = False
End IF
Next

If IsEmail AND Len(strEmail) <= 5 Then IsEmail = False
If IsEmail AND Instr(strEmail, "@") = 0 Then IsEmail = False
If IsEmail Then
strNombre = Mid(strEmail, 1, Instr(strEmail, "@") - 1)
strDominio = Mid(strEmail, Instr(strEmail, "@") + 1)
IF Instr(strDominio, ".") > 1 AND Len(strDominio) > 4 Then
If Len(strNombre) <= 1 Then
IsEmail = False
End IF
Else
IsEmail = False
End IF
End IF
End Function

Sub EnviarEmail(MailFromEmail, MailToEmail, MailSubject, MailText)
On Error Resume Next
Response.Write vbCrLf & "<!--Enviado email-->" & vbCrLf
Set Mail = Server.CreateObject("Persits.MailSender")
Mail.Host = strEmail_SMTPServer
Mail.Port = 25
Mail.From = MailFromEmail
Mail.AddAddress MailToEmail, ""
Mail.Subject = MailSubject
Mail.Body = MailText
Mail.IsHTML = False
Mail.Send
If Err.number <> 0 Then
REsponse.Write "<!--No se pudo enviar el email.-->"
REsponse.Write "<!--" & Err.Description & "-->"
End IF
Set Mail = Nothing
End Sub