[RESOLU] Générer un mail via HTML en fichir ".EML"

Répondre


Cette question est un moyen d’empêcher des soumissions automatisées de formulaires par des robots.
Smileys
:D :) :( :o :shock: :? 8-) :lol: :x :P :oops: :cry: :evil: :twisted: :roll: :wink: :!: :?: :idea: :arrow: :| :mrgreen: =D> #-o =P~ :^o :non: :priere: 8-|
Voir plus de smileys
  Revue du sujet
 

  Étendre la vue Revue du sujet : [RESOLU] Générer un mail via HTML en fichir ".EML"

Re: Générer un mail via HTML en fichir ".EML"

par wisefun77 » 30 sept. 2022, 16:29

Bonjour ynx,
Tu es le meilleur.
Cela fonctionne nickel.

Merci beaucoup pour ton savoir et ton partage.

Re: Générer un mail via HTML en fichir ".EML"

par ynx » 30 sept. 2022, 13:41

Bonjour,

Essaye d'ajouter l'entête "X-Unsent: 1" dans ton fichier EML :
From: [email protected]
To: [email protected]
Subject: Demande création de ticket pour REGUL/COMPLEMENT.
X-Unsent: 1
Content-Type: multipart/mixed; boundary=--boundary_text_string
----boundary_text_string
Content-Type: text/html; charset=UTF-8
<html>
etc...

Générer un mail via HTML en fichir ".EML"

par wisefun77 » 29 sept. 2022, 17:10

Bonjour,
Je génère un fichier en EML, mais le mail qui s'ouvre dans Outlook, ne donne pas la possibilité d'envoyer le mail.
Voici le code.

Code : Tout sélectionner

<textarea id="textbox" style="width: 300px; height: 200px;">: <!-- From: [email protected] --> To: [email protected] <!-- AddCC:[email protected] --> Subject: Demande création de ticket pour REGUL/COMPLEMENT. Content-Type: multipart/mixed; boundary=--boundary_text_string ----boundary_text_string Content-Type: text/html; charset=UTF-8 <html> <head> <body> <table border="2" content="text/html; charset=UTF-8"> <tr> <td bgcolor="blue" width="30%" ><FONT COLOR="white">Matricule Utilisateur :</FONT></td><td bgcolor="white"><?PHP print_r($_POST['username']);?></td> </tr> <tr> <td bgcolor="blue" ><FONT COLOR="white">Type intervention (INCIDENT ou DEMANDE) :</font></td><td bgcolor="white"><?PHP print_r($_SESSION['TypeMail']);?></td> </tr> <tr> <td bgcolor="blue" ><FONT COLOR="white">Groupe Assignation (assignement group) :</font></td><td bgcolor="white"><?PHP print_r($_POST['grpassign']);?></td> </tr> <tr> <td bgcolor="blue" ><FONT COLOR="white">Affectation technicien (Assigned to) :</FONT></td><td bgcolor="white"><?PHP print_r($_POST['techname']);?></td> </tr> <tr> <td bgcolor="blue" ><FONT COLOR="white">Arbre de Cloture (Work Notes) :</FONT></td><td bgcolor="white"><?PHP print_r($_SESSION['ValueGenerale']);?></td> </tr> <tr> <td bgcolor="blue" ><FONT COLOR="white">Commentaire(s) (close notes) :</FONT></td><td bgcolor="white"><?PHP print_r($_SESSION['CommentTexte']);?></td> </tr> </table> </body> </html> </textarea> </div> <button id="create"> <a download="DemandeTicketRegul.eml" id="downloadlink">Télécharger le fichier pour l'envoyer.</a></button> <!-- script de l'envoi par mail. --> <script> (function () { var textFile = null, makeTextFile = function (text) { var data = new Blob([text], {type: 'text/plain'}); if (textFile !== null) { window.URL.revokeObjectURL(textFile); } textFile = window.URL.createObjectURL(data); return textFile; }; var create = document.getElementById('create'), textbox = document.getElementById('textbox'); create.addEventListener('click', function () { var link = document.getElementById('downloadlink'); link.href = makeTextFile(textbox.value); link.style.display = 'block'; }, false); })(); </script>
voici la capture du mail sans la possibilité d'envoi.
Image

Merci