Hilos en envio de correo,
This commit is contained in:
@@ -209,24 +209,25 @@ Public Class ClsSisNotificaciones
|
||||
#Region "C O R R E O"
|
||||
|
||||
Private Sub EnviarCorreos(DTNotificacionesCorreo As DataTable)
|
||||
For Each notificacion As DataRow In DTNotificacionesCorreo.Rows
|
||||
MandaMail(notificacion("CveNotificacionBitacora").ToString.ToEntero, notificacion("Encabezado").ToString, notificacion("Cuerpo").ToString, notificacion("Correo").ToString, "")
|
||||
For Each notificacion As DataRow In DTNotificacionesCorreo.Rows
|
||||
Dim Hilo As New System.Threading.Thread(Sub() MandaMail(notificacion("CveNotificacionBitacora").ToString.ToEntero, notificacion("Encabezado").ToString, notificacion("Cuerpo").ToString, notificacion("Correo").ToString, ""))
|
||||
Hilo.Start()
|
||||
Next
|
||||
End Sub
|
||||
|
||||
Private Sub MandaMail(CveNotificacionBitacora As Integer, Asunto As String, Cuerpo As String, Mail As String, MailCC As String)
|
||||
Dim ObjMail As New ClsSisMail()
|
||||
|
||||
Dim ObjNotificacion As New ClsSisNotificaciones
|
||||
Try
|
||||
Dim ResultadoMail As Integer = 0
|
||||
Dim LSRutasMail As New List(Of ClsSisMail.ArchivoMail)
|
||||
If ObjMail.SendMail(ClsPaginas.EmpresaNotificaciones, Mail, Asunto, Cuerpo, MailCC, LSRutasMail) Then
|
||||
UpdateNotificacionesBitacoraNotifico(CveNotificacionBitacora, 1)
|
||||
ObjNotificacion.UpdateNotificacionesBitacoraNotifico(CveNotificacionBitacora, 1)
|
||||
End If
|
||||
|
||||
Catch ex As Exception
|
||||
OnError("Ocurrió error al mandar el Mail", ex)
|
||||
End Try
|
||||
ObjNotificacion.Dispose()
|
||||
End Sub
|
||||
|
||||
#End Region
|
||||
@@ -1328,10 +1329,6 @@ Public Class ClsSisNotificaciones
|
||||
Next
|
||||
End If
|
||||
|
||||
If DTNotificacionesCorreo IsNot Nothing AndAlso DTNotificacionesCorreo.Rows.Count > 0 Then
|
||||
EnviarCorreos(DTNotificacionesCorreo)
|
||||
End If
|
||||
|
||||
If DTNotificacionesApp IsNot Nothing AndAlso DTNotificacionesApp.Rows.Count > 0 Then
|
||||
Dim DtTokens As DataTable = Nothing
|
||||
|
||||
@@ -1389,6 +1386,10 @@ Public Class ClsSisNotificaciones
|
||||
DtTokens.Dispose()
|
||||
End If
|
||||
End If
|
||||
End If
|
||||
|
||||
If DTNotificacionesCorreo IsNot Nothing AndAlso DTNotificacionesCorreo.Rows.Count > 0 Then
|
||||
EnviarCorreos(DTNotificacionesCorreo)
|
||||
End If
|
||||
|
||||
If Not DTNotificacionesApp Is Nothing Then DTNotificacionesApp.Dispose()
|
||||
|
||||
Reference in New Issue
Block a user