IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

ASP Discussion :

script envoi mail et fax avec CDO


Sujet :

ASP

  1. #1
    Membre du Club
    Profil pro
    Inscrit en
    Août 2005
    Messages
    66
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Août 2005
    Messages : 66
    Points : 45
    Points
    45
    Par défaut script envoi mail et fax avec CDO
    Salut!
    j'aurais besoin de scripts permettant l'envoi de mails et de fax s'appuyant sur les objets CDO.
    pour votre aide!

  2. #2
    Expert confirmé
    Avatar de pc75
    Profil pro
    Inscrit en
    Septembre 2004
    Messages
    3 662
    Détails du profil
    Informations personnelles :
    Âge : 69
    Localisation : France, Paris (Île de France)

    Informations forums :
    Inscription : Septembre 2004
    Messages : 3 662
    Points : 4 047
    Points
    4 047
    Par défaut
    Bonjour,

    Un bout de code :

    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
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
    96
    97
    98
    99
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    110
    111
    112
    113
    114
    115
    116
    117
    118
    119
    120
    121
    122
    123
    124
    125
    126
    127
    128
    129
    130
    131
    132
    133
    134
    135
    136
    137
    138
    139
    140
    141
    142
    143
    144
    145
    146
    147
    148
    149
    150
    151
    152
    153
    154
    155
    156
    157
    158
    159
    160
    161
    162
    163
    164
    165
    166
    167
    168
    169
    170
    171
    172
    173
    174
    175
    176
    177
    178
    179
    180
    181
    182
    183
    184
    185
    186
    187
    188
     
    <%@ Language=VBScript %>
    <HTML>
    <HEAD>
    <title>
    </title>
    </HEAD>
    <BODY bgcolor="#fefceb">
     
    <p align="center">
    	<font face="Arial" color="#0099cc" size="4">
    	<strong>
    	Envoi du courrier	<br><br>
    	</strong>
    	</font>
    </p>
     
    <br><br><br>
     
    <form name="frmSaisie" method="post" action="Envoyer.asp">
    	<input type="hidden" name="txtLettre" value="<%=Str_Lettre%>">
    	<table align="center" border="0">
    		<tr>
    			<td>
    				<font face="Arial" color="#0099cc" size="2">
    				<strong>
    				Sujet :
    				</strong>
    				</font>
    			</td>
    			<td>
    				<input type="text" name="txtSujet" value="Lettre" size="50">
    			</td>
    		</tr>
     
    		<tr>
    			<td colspan="2">
    				&nbsp;
    			</td>
    		</tr>
     
    		<tr>
    			<td>
    				<font face="Arial" color="#0099cc" size="2">
    				<strong>
    				De la part de :
    				</strong>
    				</font>
    			</td>
    			<td>
    				<input type="text" name="txtFrom" size="50">
    			</td>
    		</tr>
     
    		<tr>
    			<td colspan="2">
    				&nbsp;
    			</td>
    		</tr>
     
    		<tr>
    			<td>
    				<font face="Arial" color="#0099cc" size="2">
    				<strong>
    				Expéditeur :
    				</strong>
    				</font>
    			</td>
    			<td>
    				<input type="text" name="txtSender" size="50">
    			</td>
    		</tr>
     
    		<tr>
    			<td colspan="2">
    				&nbsp;
    			</td>
    		</tr>
     
    		<tr>
    			<td>
    				<font face="Arial" color="#0099cc" size="2">
    				<strong>
    				Option des destinataires :
    				</strong>
    				</font>
    			</td>
    			<td>
    				&nbsp;&nbsp;
    				<font face="Arial" color="#0099cc" size="2">
    				<strong>
    				A :
    				</strong>
    				</font>
    				<input type="radio" name="txtOption" value="OptionA">
    				&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
     
    				<font face="Arial" color="#0099cc" size="2">
    				<strong>
    				Cc :
    				</strong>
    				</font>
    				<input type="radio" name="txtOption" value="OptionCc">
    				&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
     
    				<font face="Arial" color="#0099cc" size="2">
    				<strong>
    				Cci :
    				</strong>
    				</font>
    				<input type="radio" checked name="txtOption" value="OptionCci">
    			</td>
    		</tr>
     
    		<tr>
    			<td colspan="2">
    				&nbsp;
    			</td>
    		</tr>
     
    		<tr>
    			<td>
    				<font face="Arial" color="#0099cc" size="2">
    				<strong>
    				Importance :
    				</strong>
    				</font>
    			</td>
    			<td>
    				&nbsp;&nbsp;
    				<font face="Arial" color="#0099cc" size="2">
    				<strong>
    				Basse :
    				</strong>
    				</font>
    				<input type="radio" name="txtImportance" value="0">
    				&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
     
    				<font face="Arial" color="#0099cc" size="2">
    				<strong>
    				Normale :
    				</strong>
    				</font>
    				<input type="radio" checked name="txtImportance" value="1">
    				&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
     
    				<font face="Arial" color="#0099cc" size="2">
    				<strong>
    				Haute :
    				</strong>
    				</font>
    				<input type="radio" name="txtImportance" value="2">
    			</td>
    		</tr>
     
    		<tr>
    			<td colspan="2">
    				&nbsp;
    			</td>
    		</tr>
     
    		<tr>
    			<td>
    				<font face="Arial" color="#0099cc" size="2">
    				<strong>
    				Source du message :
    				</strong>
    				</font>
    			</td>
    			<td>
    				<input type=file name=browse style="display: none;">
    				<input type=text name=file size="50">
    				<input type=button 
    				onClick="browse.disabled=false;browse.click();file.value=browse.value;browse.disabled=true"
    				value=" . . . "> 
    			</td>
    		</tr>
    	</table>
     
    	<br><br><br><br>
     
    	<p align="center">
    		<input type="submit" name="cmdEnvoyer" value="Envoyer">
    	</p>
    </form>
     
    </BODY>
    </HTML>

    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
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
     
    <%
    Set oMail = Server.CreateObject("CDO.Message")
    Set oMailConfig = Server.CreateObject ("CDO.Configuration")
     
    oMailConfig.Fields("http://schemas.microsoft.com/cdo/configuration/smtpserver") = Application("ServerSMTP")
    oMailConfig.Fields("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25
    oMailConfig.Fields("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
    oMailConfig.Fields("http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout") = 60
    oMailConfig.Fields.Update
    Set oMail.Configuration = oMailConfig
     
    oMail.Sender = Replace(Request.Form("txtSender"), " ", "<space>")
    'oMail.ReplyTo = "Mezigue@ici.fr"
     
    oMail.From = Request.Form("txtFrom")
     
    Recip = "A1@ici.fr;A2@ici.fr"
    select case Request.Form("txtOption")
    	case "OptionA"
    		oMail.To = Recip
    	case "OptionCc"
    		oMail.Cc = Recip
    	case "OptionCci"
    		oMail.Bcc = Recip
    end select
     
    oMail.Fields("urn:schemas:httpmail:importance").value = Request.Form("txtImportance")
    oMail.Fields.Update()
     
    oMail.Subject = Request.Form("txtSujet")
    'oMail.HTMLBody = "<b>Contenu du message ...</b>" & vbcrlf ' HTML
    'oMail.TextBody = "suite du contenu" ' TEXTE
     
    if len(trim(Request.Form("file"))) > 0 then
    	oMail.CreateMHTMLBody "file://" & Request.Form("file")
    end if
     
    oMail.Send
     
    Set oMailConfiguration = Nothing
    Set oMailConfig = Nothing
    Set oMail = Nothing
     
    if Err = 0 then
    %>
    	<HTML>
    	<HEAD>
    	<META NAME="GENERATOR" Content="Microsoft Visual Studio 6.0">
    	</HEAD>
    	<BODY bgcolor="#fefceb">
    	<br><br><br><br><br><br><br><br>
    	<P align="center">
    		<font face="Arial" color="#0099cc" size="3">
    		<strong>
    		Message envoyé avec succès.
    		</strong>
    		</font>
    	</P>
     
    	<br><br><br><br>
     
    	</BODY>
    	</HTML>
    <%
    end if
    %>

Discussions similaires

  1. pb envoi mail "Could not access 'CDO.Message' object"
    Par adaneels dans le forum ASP.NET
    Réponses: 3
    Dernier message: 07/05/2009, 15h29
  2. Mail sous ASP avec CDO ne s'envoi pas
    Par dragonfly dans le forum ASP
    Réponses: 14
    Dernier message: 13/04/2007, 14h00
  3. Problème Mailing-List ASP avec CDO et access
    Par francois_pignon dans le forum ASP
    Réponses: 3
    Dernier message: 04/06/2006, 21h31
  4. [Mail] envoi mail en masse avec fonction bcc
    Par jarod71 dans le forum Langage
    Réponses: 5
    Dernier message: 08/03/2006, 11h44
  5. Envoi mail par Notes avec un autre nom
    Par why-not-mi dans le forum VB 6 et antérieur
    Réponses: 4
    Dernier message: 20/10/2005, 16h35

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo