bonjour tt le monde,
depuis plusieurs jours de recherche, je suis pas capable de m'ensortir et pour cela je m'adresse a vous.
j'ai un souci un niveau de lenvoi dun email en vb.net et voila message d'erreur:
System.ArgumentOutOfRangeException: L'index et la longueur doivent faire référence à un emplacement situé dans la chaîne. Nom du paramètre : length à System.String.InternalSubStringWithChecks(Int32 startIndex, Int32 length, Boolean fAlwaysCopy) à System.String.Substring(Int32 startIndex, Int32 length) à PoMailPh.frmPrinc.fct_send_mail(String m_from, String m_to, String m_subject, Int32 m_type, String m_msg, String f_name) à PoMailPh.frmPrinc.fct_exec_sql(String strSql) à PoMailPh.frmPrinc.fct_fill_sql(String[] lines, String sqltype)

et voila la partie de code qui permetd e faire ca:
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
 
Private Sub fct_send_mail(ByVal m_from As String, ByVal m_to As String, ByVal m_subject As String, ByVal m_type As Integer, ByVal m_msg As String, ByVal f_name As String)
 
        Try
            'Variable pour la création du courriel
            Dim smtp_svr As SmtpMail
            Dim msg As New MailMessage
            Dim fileAttach As MailAttachment
            'Ne pas envoyer de message si no de PO non Défini ou si (line 676) le po ne contient pas de lignes, c'est simplement un po annuler mais qui sort quand meme de fdm
            If InStr(m_subject, "none") = 0 And InStr(m_msg, "line 676") = 0 Then
                'Définition du serveur smtp
                smtp_svr.SmtpServer = smtp
 
                'Définition du core du courriel
                msg.From = m_from.Trim                                                        'Envoyeur*****************************************
                msg.BodyFormat = MailFormat.Html                                              'Format (txt ou html)*****************************
                msg.To = m_to                                                                 'Destinataire*************************************
                msg.Subject = m_subject                                                       'Sujet********************************************
                msg.Body = m_msg                                                              'Message******************************************
                msg.Priority = MailPriority.Normal                                            'priorité NORMAL, HIGH, LOW***********************
 
                If m_type = 1 Then                                                            'Pièce jointe seulement si c'est un envoi de po***
                    fileAttach = New MailAttachment(f_out & f_name & ".xls")                  'Création d'une piece jointe**********************
                    msg.Attachments.Add(fileAttach)                                           'Ajout de la pièce jointe*************************
                End If
                'Envoi du courriel au destinataire
                smtp_svr.Send(msg)
            End If
        Catch ex As Exception
            fct_send_mail(envoyeur, warning, "ERREUR PO VIA MAIL " & f_name, 0, ex.ToString, "none")
            '# erreur no 6
            fct_exec_sql("UPDATE pur_order SET err=6 WHERE pur_order.po_number='" & f_name.Substring(3, 8) & "'")
        End Try
 
    End Sub
merci beaucoup et jai vraiment besoin de votre aide