Estimados, tengo el siguiente problema y agradezco de antemano la ayuda que me puedan dar
Tengo una rutina para enviar por mail un archivo PDF como adjunto En desarrollo funciona correctamente, y cuando lo uso en producción instalado en la pc de mi cliente no funciona (esto es lo que nos vuelve locos a la mayoría de los programadores) El tema es así: Utilizo VS 2010 con lenguaje vb.net se genera un archivo PDF exportado desde reporte crystal Report (InvoiceNumber_00000026.pdf) se envía por mail a una dirección de correo electrónico como adjunto el archivo generado en el paso anterior y un archivo htm (statements_00202823.htm) también como adjunto el mail se envía correctamente, sin errores ahora viene el problema Si lo envío desde mi pc (entorno de desarrollo) el mail llega a la dirección de correo indicada, con los 2 adjunto, el PDF y el HTM ambos con el nombre que se envió desde el aplicativo Si lo envío desde la pc del cliente (entorno de producción) el mail llega a la dirección de correo indicada, con los 2 adjuntos, pero el PDF llega con el nombre =_utf-8_B_SW52b2ljZSBOwrogMDAwMDAwMjkgLSBB.pdf y no se puede abrir, el htm llega con el nombre correcto y se puede abrir sin problemas El contenido del archivo =_utf-8_B_SW52b2ljZSBOwrogMDAwMDAwMjkgLSBB.pdf es el siguiente =?utf-8?B?WTJOdmRXNTBJRTUxYldKbGNpQXdNakF5Pz0NCiA9P3V0Zi04P0I/T0RJ?=\ \ =?utf-8?B?ekxsQkVSZz09Pz0=?=" Content-Transfer-Encoding: base64 Content-Disposition: attachment JVBERi0xLjcgCiXi48/TIAoxIDAgb2JqIAo8PCAKL1R5cGUgL0NhdGFsb2cgCi9Q YWdlcyAyIDAgUiAKL1BhZ2VNb2RlIC9Vc2VOb25lIAovVmlld2VyUHJlZmVyZW5j Y continua cerca de 41k mas que no lo incluyo para no hacer muy grande este correo A continuación transcribo la función que utilizo para el envío de correo Private Sub Enviar() Dim objSmtp As New System.Net.Mail.SmtpClient Dim Mailmsg As System.Net.Mail.MailMessage Dim fromAddress As System.Net.Mail.MailAddress = Nothing Dim strBody As String = "" Dim strAsunto As String = "" Dim blnEnviado As Boolean = True Try Me.bdsInvoice.EndEdit() With Me.dtsDatos.ServidorCorreo(0) objSmtp.Host = .SMTP.Trim objSmtp.Port = .PuertoSMTP objSmtp.EnableSsl = .SSLHabilitado If .UsuarioSTMP.Trim <> "" Then objSmtp.Credentials = New System.Net.NetworkCredential(.UsuarioSTMP, .ContraseñaSMTP) End If fromAddress = New System.Net.Mail.MailAddress(.Mail, .Remitente) End With For Each row As dtsInvoice.InvoiceRow In Me.dtsInvoice.Invoice.Select("Enviado = 0") Dim toAddress As System.Net.Mail.MailAddress = Nothing Dim strArchivoPDF As String = "" Dim strArchivoHTM As String = Archivos.DirectorioTemporal.Trim & "Statement_" & row.AccountNumber.ToString.PadLeft(7, "0") & ".htm" With Me.dtsDatos.Clientes.FindByID_Cliente(row.ID_Cliente) toAddress = New System.Net.Mail.MailAddress(.Mail.Trim, .Nombre.Trim) Dim dtsImpresion As New dtsImpresion Impresion.PrepararDatasetImpresion(dtsImpresion, dtsDatos, .ID_Cliente, row.InvoiceNumber) strArchivoPDF = Impresion.ImprimirInvoice(dtsImpresion, .AccountNumber, row.InvoiceNumber, True) strAsunto = strBody = End With If row.HTML.Trim <> "" Then System.IO.File.WriteAllText(strArchivoHTM, row.HTML) End If With Me.dtsDatos.ServidorCorreo(0) strBody = strBody & vbCrLf & vbCrLf & .Firma End With Mailmsg = New System.Net.Mail.MailMessage() With Mailmsg .From = fromAddress .IsBodyHtml = False .Subject = strAsunto If strArchivoPDF.Trim <> "" AndAlso System.IO.File.Exists(strArchivoPDF) Then .Attachments.Add(New Net.Mail.Attachment(GetStreamFile(strArchivoPDF), IO.Path.GetFileName(strArchivoPDF), "application/pdf")) End If If strArchivoHTM.Trim <> "" AndAlso System.IO.File.Exists(strArchivoHTM) Then .Attachments.Add(New Net.Mail.Attachment(GetStreamFile(strArchivoHTM), IO.Path.GetFileName(strArchivoHTM))) End If .Body = strBody .Bcc.Add(fromAddress) .To.Add(toAddress) Try objSmtp.Send(Mailmsg) Catch ex As System.Net.Mail.SmtpException blnEnviado = False End Try End With Mailmsg = Nothing Next Catch ex As Exception Throw ex End Try End sub Private Function GetStreamFile(filePath As String) As IO.Stream Using fileStream As IO.Stream = IO.File.OpenRead(filePath) Dim memStream As New IO.MemoryStream() memStream.SetLength(fileStream.Length) fileStream.Read(memStream.GetBuffer(), 0, CInt(fileStream.Length)) Return memStream End Using End Function