Bonjour tout le monde.
tout d'abord, j'espère que je ne me trompe pas de section.
Je pose le problème : nous développons une application en HTML / Javascript qui doit fonctionner via IE en mode local ; nous avons donc accès aux ActiveX.
Cette application doit envoyer une certain nombre de mail dont le corps sera plus ou moins important.
Voici le code que j'utilise :
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
|
alert("début smtp");
var objEmail = new ActiveXObject("CDO.Message");
objEmail.From = "...@...";
objEmail.To = "...@...";
objEmail.Cc = "...@...";
objEmail.Subject = WObjet; // "HELLO WORLD";
WCorps = "### EMAIL DE TEST ###" + G_CrLf;
WCorps = WCorps + "Expediteur = " + objEmail.From + G_CrLf;
WCorps = WCorps + "Destinataire = " + objEmail.To + G_CrLf;
WCorps = WCorps + "Copie = " + objEmail.Cc + G_CrLf;
WCorps = WCorps + "Sujet = " + objEmail.Subject + G_CrLf;
WCorps = WCorps + "01_NOM_FICHIER_AVEC_ESPACE_129 1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890" + G_CrLf;
WCorps = WCorps + "02_NOM_FICHIER_AVEC_ESPACE_129 1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890" + G_CrLf;
WCorps = WCorps + "03_NOM_FICHIER_AVEC_ESPACE_129 1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890" + G_CrLf;
WCorps = WCorps + "04_NOM_FICHIER_AVEC_ESPACE_129 1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890" + G_CrLf;
WCorps = WCorps + "05_NOM_FICHIER_AVEC_ESPACE_129 1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890" + G_CrLf;
WCorps = WCorps + "06_NOM_FICHIER_AVEC_ESPACE_129 1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890" + G_CrLf;
WCorps = WCorps + "07_NOM_FICHIER_AVEC_ESPACE_129 1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890" + G_CrLf;
WCorps = WCorps + "08_NOM_FICHIER_AVEC_ESPACE_129 1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890" + G_CrLf;
objEmail.Textbody = WCorps;
objEmail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2;
objEmail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "serveursmtp";
objEmail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25;
objEmail.Configuration.Fields.Update();
objEmail.Send();
alert("fin smtp"); |
J'ai l'impression qu'il y a une limite dans la taille du corps car certains des mails arrivent bien alors que d'autres se perdent, je ne sais trop où !
Et je ne sais plus quels tests faire.
Je voudrai aussi pouvoir y adjoindre des pièces jointes, mais
objEmail.Addattachment "c:\fichier.TXT";
ne fonctionne pas ???
Qu'est-ce que je fais de mal ?
Merci d'avance pour votre aide.
Partager