Bonjour,
svp j'ai petit souci concernant les mails asp.net
voila un code que j'ai trouvé dans une autre source ésperant qu'il va servir un jour à quelqu'un
mais voila le probléme c'est quand je veux attacher un fichier lor de l'envoi d'un mail
est ce que quelqu'un peut me proposer une modification pour permettre d'attacher un fichier
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
36
37
38
 
   Const cdoSendUsingMethod = "http://schemas.microsoft.com/cdo/configuration/sendusing"
        Const cdoSendUsingPort = 2
        Const cdoSMTPServer = "http://schemas.microsoft.com/cdo/configuration/smtpserver"
        Const cdoSMTPServerPort = "http://schemas.microsoft.com/cdo/configuration/smtpserverport"
        Const cdoSMTPConnectionTimeout = "http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout"
        Const cdoSMTPAuthenticate = "http://schemas.microsoft.com/cdo/configuration/smtpauthenticate"
        Const cdoBasic = 1
        Const cdoSendUserName = "http://schemas.microsoft.com/cdo/configuration/sendusername"
        Const cdoSendPassword = "http://schemas.microsoft.com/cdo/configuration/sendpassword"
        Dim objConfig
        Dim objMessage
        Dim Fields
 
        objConfig = Server.CreateObject("CDO.Configuration")
        Fields = objConfig.Fields
 
        With Fields
            .Item(cdoSendUsingMethod) = cdoSendUsingPort
            .Item(cdoSMTPServer) = "smtp.gmail.com"
            .Item(cdoSMTPServerPort) = 465
            .Item(cdoSMTPAuthenticate) = cdoBasic
            .Item(cdoSendUserName) = "monlogin"
            .Item(cdoSendPassword) = "monpass"
            .Update()
        End With
        objMessage = Server.CreateObject("CDO.Message")
        objMessage.Configuration = objConfig
        With objMessage
            .To = TextBox5.Text
            .From = TextBox3.Text
            .Subject = "zefzefzfzefzef"
            .TextBody = "zezzefzefzefzefzefzezefzzf"
            .Send()
        End With
        Fields = Nothing
        objMessage = Nothing
        objConfig = Nothing