Contenu javascript vers gmail

Julienw5 -  
 Julienw5 -
Bonjour,

Je réalise une application avec phonegap, et j'envoi le contenu d'un mail, de javascript, directement dans le contenu d'un mail, Gmail, un peu comme on le ferait avec mailto.

Mais j'aimerai savoir pourquoi, quand je remplis ce message d'html, il ne le prend pas en compte et me fournit ça comme du texte ?

3 réponses

  1. Julienw5
     
    email_total =
    
    '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> ' +
    '<html xmlns="http://www.w3.org/1999/xhtml"> ' +
    '<head> ' +
    '    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> ' +
    '    <title>Données de vol | AERIA-APP</title> ' +
    '<style type="text/css"> ' +
    '    .ExternalClass {width:100%;}  ' +
    '    .ExternalClass, .ExternalClass p, .ExternalClass span, .ExternalClass font, .ExternalClass td, .ExternalClass div { ' +
    '        line-height: 100%; ' +
    '        }  ' +
    '    body {-webkit-text-size-adjust:none; -ms-text-size-adjust:none;} ' +
    '    body {margin:0; padding:0;}  ' +
    '    table td {border-collapse:collapse;border:1px solid #000000; padding:5px 35px;}     ' +
    '    p {margin:0; padding:0; margin-bottom:0;} ' +
    '  h1, h2, h3, h4, h5, h6 { ' +
    '     color: black;  ' +
    '    line-height: 100%;  ' +
    '       }  ' +
    '   a, a:link { ' +
    '       color:#2A5DB0; ' +
    '       text-decoration: underline; ' +
    '       }  ' +
    ' body, #body_style { ' +
    '    background:#fff; ' +
    '    min-height:1000px; ' +
    '    color:#000; ' +
    '    font-family:Arial, Helvetica, sans-serif; ' +
    '    font-size:12px; ' +
    '    } ' +
    '  span.yshortcuts { color:#000; background-color:none; border:none;} ' +
    '  span.yshortcuts:hover, ' +
    '  span.yshortcuts:active, ' +
    '  span.yshortcuts:focus {color:#000; background-color:none; border:none;} ' +
    '  a:visited { color: #3c96e2; text-decoration: none}  ' +
    '  a:focus   { color: #3c96e2; text-decoration: underline}   ' +
    '  a:hover   { color: #3c96e2; text-decoration: underline}   ' +
    '    @media only screen and (max-device-width: 480px) { ' +
    '           body[yahoo] #container1 {display:block !important} ' +
    '           body[yahoo] p {font-size: 10px} ' +
    '    }  ' +    
    '    @media only screen and (min-device-width: 768px) and (max-device-width: 1024px)  { ' +
    '           body[yahoo] #container1 {display:block !important} ' +
    '           body[yahoo] p {font-size: 12px}   ' +       
    '    }  ' +             
    ' </style>  ' +
    ' </head> ' +
    ' <body style="background:#fff; min-height:1000px; color:#000;font-family:Arial, Helvetica, sans-serif; font-size:12px" ' +
    ' alink="#FF0000" link="#FF0000" bgcolor="#fff" text="#000" yahoo="fix">  ' +
    '    <div id="body_style" style="padding:15px">  ' +
    '        <table cellpadding="0" cellspacing="0" border="0" bgcolor="" width="600" align="center"> ' +
    '            <tr>' + 
    '                <td style="font-weight:900;" color:#0ff; text:0ff; width="200">ID</td>' + 
    '                <td style="font-weight:900;" color:#0ff; text:0ff; width="200">DATE</td>' + 
    '                <td style="font-weight:900;" color:#0ff; text:0ff; width="200">TYPE</td>' + 
    '                <td style="font-weight:900;" color:#0ff; text:0ff; width="200">MODELE</td>' + 
    '                <td style="font-weight:900;" width="200">IMMATRIC.</td>' + 
    '                <td style="font-weight:900;" width="200">START</td>' + 
    '                <td style="font-weight:900;" width="200">LANDING</td>' + 
    '                <td style="font-weight:900;" width="200">H.START</td>' + 
    '                <td style="font-weight:900;" width="200">H.LANDING</td>' + 
    '                <td style="font-weight:900;" width="200">TOTAL</td>' + 
    '                <td style="font-weight:900;" width="200">MONITOR</td>' + 
    '                <td style="font-weight:900;" width="200">NBR.START</td>' + 
    '            </tr>' + 
                donnee +
    '         </table>  ' +
    '     </div> ' +
    ' </body> ' +
    ' </html> ' 
    ;


    Résultat de l'email :

    Données de vol | AERIA-APP .ExternalClass {width:100%;} .ExternalClass, .ExternalClass p, .ExternalClass span, .ExternalClass font, .ExternalClass td, .ExternalClass div { line-height: 100%; } body {-webkit-text-size-adjust:none; -ms-text-size-adjust:none;} body {margin:0; padding:0;} table td {border-collapse:collapse;border:1px solid #000000; padding:5px 35px;} p {margin:0; padding:0; margin-bottom:0;} h1, h2, h3, h4, h5, h6 { color: black; line-height: 100%; } a, a:link { color:#2A5DB0; text-decoration: underline; } body, #body_style { background:#fff; min-height:1000px; color:#000; font-family:Arial, Helvetica, sans-serif; font-size:12px; } span.yshortcuts { color:#000; background-color:none; border:none;} span.yshortcuts:hover, span.yshortcuts:active, span.yshortcuts:focus {color:#000; background-color:none; border:none;} a:visited { color: #3c96e2; text-decoration: none} a:focus { color: #3c96e2; text-decoration: underline} a:hover { color: #3c96e2; text-decoration: underline} @media only screen and (max-device-width: 480px) { body[yahoo] #container1 {display:block !important} body[yahoo] p {font-size: 10px} } @media only screen and (min-device-width: 768px) and (max-device-width: 1024px) { body[yahoo] #container1 {display:block !important} body[yahoo] p {font-size: 12px} }

    IDDATETYPEMODELEIMMATRIC.STARTLANDINGH.STARTH.LANDINGTOTALMONITORNBR.START00:00:00122/05/2015avioncessnagtrebshebsh12:1812:1800:00:001226/05/2015avioncessnagtoebshebsh15:0515:0500:00:001

    Donc on peut voir qu'il garde et supprime certaine balise.
    0
    1. Julienw5
       
      Par exemple il prend en compte la balise font..
      0
  2. prosthetiks Messages postés 1309 Statut Membre 431
     
    Hello,

    je peux voir ta fonction d'envoi de mail ? là ou tu set le destinataire, le body, ...
    0
    1. Julienw5
       
      Voilà :

       $('#donnee_mail').click(function () { 
          cordova.plugins.email.open({
              to:      localStorage.getItem('mail'),
              subject: 'Vos données de vol - aeria-app',
              body:    email_total,
              isHtml:    true,
          });
      });
      
      0
  3. prosthetiks Messages postés 1309 Statut Membre 431
     
    0
    1. Julienw5
       
      Je l'ai vus mais comment faire pour aligner mon contenu ? ou au moins faire des bloques ?
      0
    2. prosthetiks Messages postés 1309 Statut Membre 431
       
      il semblerait que les <div align="..."> soient autorisés
      0
    3. Julienw5
       
      J'ai testé mais ca n'avait pas l'air de marcher, je vais réessayer ;).
      Mise à part ça, aucune autre solution ?
      0
    4. Julienw5
       
      Il faudrait au moins pouvoir donner une width...
      0
    5. prosthetiks Messages postés 1309 Statut Membre 431
       
      tu as essayé de donner la taille via les attributs html ? p.ex <div width="100%">
      0