Spero di non ripetere post precedenti ma dopo una bella ricerca mi sono impantanato....
ho trovato e riadattato questo codice per inviare mail tramite socket
codice:WaitFor ("220") If (networkErr = True) Then GoTo stop_send porta = socket.LocalPort dataTime = "Data " & Format(Date, "Long Date") & " / " & Time ' Ingresso sul server di posta socket.SendData ("HELO" + vbCrLf) ' Saluto il server WaitFor ("250") If (networkErr = True) Then GoTo stop_send ' Specifica mittente (controlla relay del server) socket.SendData ("MAIL FROM: <" & Txtfrom.Text & ">" + vbCrLf) WaitFor ("250") If (networkErr = True) Then GoTo stop_send ' Specifica destinatario socket.SendData ("RCPT TO: <" & lstMailing.List(i) & ">" + vbCrLf) WaitFor ("250") If (networkErr = True) Then GoTo stop_send ' Corpo dell'e-mail socket.SendData ("DATA" + vbCrLf) WaitFor ("354") If (networkErr = True) Then GoTo stop_send socket.SendData ("From: """ & txtIntestazione.Text & """ <" & Txtfrom.Text & ">" + vbCrLf) socket.SendData ("To: """ & txtNome.Text & """ <" & Txtto.Text & ">" + vbCrLf) socket.SendData ("Subject: " & Txtsubject & " " + vbCrLf + vbCrLf) ' Creo il file di testo per la spedizione If Dir(App.Path + "\" + Filename) <> "" Then Kill (App.Path + "\" + Filename) Dim fe As Integer fe = FreeFile() Open App.Path + "\" + Filename For Binary Access Write As fe Put fe, , aperturamail & Txtbody.Text & chiusuramail Close fe 'Apro il file in lettura e lo invio riga dopo riga Dim TextLine Open (App.Path + "\" + Filename) For Input As #2 Do While Not EOF(2) Line Input #2, TextLine socket.SendData (TextLine + vbCrLf) Loop Close #2 'socket.SendData ("Local Port: " & porta + vbCrLf + vbCrLf) 'socket.SendData ("Local HostName: " & socket.LocalHostName + vbCrLf + vbCrLf) 'socket.SendData ("Local IP: " & socket.LocalIP + vbCrLf + vbCrLf) 'socket.SendData ("------------------------------------------" + vbCrLf + vbCrLf) 'socket.SendData (dataTime + vbCrLf + vbCrLf) If logoFile <> "" And Check1.Value = 1 Then If Dir(App.Path + "\" + logoFile) <> "" Then UU = "" uuEncodeToFile "x.uue", logoFile Dim ff As Integer ff = FreeFile() Open "x.uue" For Input As ff Do While Not EOF(ff) Line Input #ff, l socket.SendData l & Chr$(13) & Chr$(10) Loop Close ff End If End If ' Chiudo l'E-mail socket.SendData ("." + vbCrLf) WaitFor ("250") If (networkErr = True) Then GoTo stop_send socket.SendData ("QUIT" + vbCrLf) ' Chiudo il Socket WaitFor ("221") socket.Close
La mail la invia correttamente.....
il problema è che vorrei impostargli che la mail vada letta come html in quanto il testo della mail è una pagina html che referenzia con immagini ed altro al mio sito....
qualcuno mi può aiutare?
![]()

Rispondi quotando