Error al mandar correo

This commit is contained in:
2020-06-23 17:37:57 -07:00
parent e8ceae054c
commit 0c5fcc1e83

View File

@@ -3344,39 +3344,43 @@ Partial Class Bancos_PagoElectronicoGrupos
End Sub End Sub
Private Sub MandaCorreo(Para As String, Asunto As String, Body As String, CveIE As Integer, Comprobante As String, File As Byte()) Private Sub MandaCorreo(Para As String, Asunto As String, Body As String, CveIE As Integer, Comprobante As String, File As Byte())
Try
Dim Mail As New ClsSisMail()
Para = If(Para IsNot Nothing, Para, "")
Asunto = If(Asunto IsNot Nothing, Asunto, "")
Body = If(Body IsNot Nothing, Body, "")
Dim Mail As New ClsSisMail() Dim ListaArchivos As New List(Of ClsSisMail.ArchivoMail)
Para = If(Para IsNot Nothing, Para, "") If Comprobante IsNot Nothing AndAlso Comprobante <> "" Then
Asunto = If(Asunto IsNot Nothing, Asunto, "") ListaArchivos.Add(New ClsSisMail.ArchivoMail With {.Ruta = Comprobante})
Body = If(Body IsNot Nothing, Body, "")
Dim ListaArchivos As New List(Of ClsSisMail.ArchivoMail)
If Comprobante IsNot Nothing AndAlso Comprobante <> "" Then
ListaArchivos.Add(New ClsSisMail.ArchivoMail With {.Ruta = Comprobante})
End If
If File IsNot Nothing Then
ListaArchivos.Add(New ClsSisMail.ArchivoMail With {.ArchivoBinario = File, .NombreArchivo = "EstadoCuentaCxP.pdf"})
End If
Dim separador As Char() = {";"c, ","c}
Dim strArray As String() = Para.Split(separador)
Para = ""
For Each sCorreo As String In strArray
If ClsSisMail.IsMailShared(sCorreo) And sCorreo.Trim.Length > 0 Then
Para = $"{Para}{sCorreo};"
End If End If
Next
Para = Para.Substring(0, Para.Length - 1) If File IsNot Nothing Then
ListaArchivos.Add(New ClsSisMail.ArchivoMail With {.ArchivoBinario = File, .NombreArchivo = "EstadoCuentaCxP.pdf"})
End If
Dim separador As Char() = {";"c, ","c}
Dim strArray As String() = Para.Split(separador)
Para = ""
For Each sCorreo As String In strArray
If ClsSisMail.IsMailShared(sCorreo) And sCorreo.Trim.Length > 0 Then
Para = $"{Para}{sCorreo};"
End If
Next
Para = Para.Substring(0, Para.Length - 1)
If Mail.SendMail(ClsPaginas.EmpresaNotificaciones, Para, Asunto, Body, Archivos:=ListaArchivos, Displayname:=$"SIG Notificaciones: Pago de {UsuarioActual.Empresa.Empresa}") Then
Dim objIE As New ClsBancos
objIE.UpdateBancos_IENotificaciones(1, "-1", "-1", CveIE)
objIE.Dispose()
End If
Catch ex As Exception
OnError("Ocurrio un error al enviar el correo", ex)
End Try
If Mail.SendMail(ClsPaginas.EmpresaNotificaciones, Para, Asunto, Body, Archivos:=ListaArchivos, Displayname:=$"SIG Notificaciones: Pago de {UsuarioActual.Empresa.Empresa}") Then
Dim objIE As New ClsBancos
objIE.UpdateBancos_IENotificaciones(1, "-1", "-1", CveIE)
objIE.Dispose()
End If
End Sub End Sub