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

Langage PHP Discussion :

[Mail] mail et Gmail


Sujet :

Langage PHP

  1. #1
    Membre à l'essai
    Profil pro
    Inscrit en
    Avril 2006
    Messages
    27
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Avril 2006
    Messages : 27
    Points : 12
    Points
    12
    Par défaut [Mail] mail et Gmail
    bonjour, jai creer un programme afn d'envoyer un mail incluant une image! mon mail fonctionne mais pas quand j'envoie sur gmail! lorsqu'il arrive sur gmail il me met tout mon code et je ne sais pas pourquoi?
    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
    189
    190
    191
    192
    193
    194
    195
    196
    197
    198
    199
    200
    201
    202
    203
    204
    205
    206
    207
    208
    209
    210
    211
    212
    213
    214
    215
    216
    217
    218
    219
    220
    221
    222
    223
    224
    225
    226
    227
    228
    229
    230
    231
    232
    233
    234
    235
    236
    237
    238
    239
    240
    241
    242
    243
    244
    245
    246
    247
    248
    249
    250
    251
    252
    253
    254
    255
    256
    257
    258
    259
    260
     
    <?
     include("style.inc");
     
    //destinataire :
    $add = "<a href="mailto:k.beta@gmail.com">k.beta@gmail.com</a>";
    // sujet :
    $subject = $_POST['sujet'];
    // message :
    $delimiteur="-----=".md5(uniqid(rand())); 
      $headers  = "MIME-Version: 1.0\r\n";   
      $headers .= "Content-Type: multipart/related;
      boundary=\"$delimiteur\"\r\n";   
      $headers .= "\r\n";
      $msg="Je vous informe que ceci est un message au format MIME 1.0 multipart/mixed.\r\n";
      $msg .= "--$delimiteur\r\n";
      $msg .= "Content-Type: text/html; charset=\"iso-8859-1\"\r\n";
      $msg .= "Content-Transfer-Encoding:8bit\r\n";
      $msg .= "\r\n";
     
      $msg .="<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0 Transitional//EN\">
    <HTML><HEAD><TITLE>Document sans titre</TITLE>
    </HEAD>
    <BODY>
    <TABLE cellSpacing=0 cellPadding=0 width=672 border=0>
      <TBODY>
      <TR>
        <TD width=119><A
          href=\"<A href="http://www.alfa.fr/index.html\"><IMG">http://www.alfa.fr/index.html\"><IMG
          src=\"cid:image1\" width=\"119\" height=\"104\" border=\"0\"></A></TD>
        <TD width=325><A
          href=\"<A href="http://www.alfa.fr/index.html\"><IMG">http://www.alfa.fr/index.html\"><IMG
          height=104 src=\"cid:image2\" width=325
        border=0></A></TD>
        <TD>&nbsp;</TD>
        <TD vAlign=top align=right width=215>
          <DIV align=center><IMG height=35 src=\"cid:image3\"
          width=214><BR><BR></DIV></TD>
        <TD width=15>&nbsp;</TD></TR></TBODY></TABLE>
    <TABLE cellSpacing=0 cellPadding=0 width=672 border=0>
      <TBODY>
      <TR>
        <TD width=119>&nbsp;</TD>
        <TD vAlign=top background=\"cid:image4\">
          <TABLE cellSpacing=0 cellPadding=0 width=420 border=0>
            <TBODY>
            <TR>
              <TD height=22>&nbsp;</TD>
              <TD height=22>&nbsp;</TD>
              <TD height=22>&nbsp;</TD></TR>
            <TR>
              <TD width=140>&nbsp;</TD>
              <TD>".$txtblc."Vos cours de musique<BR>à domicile,
                rendez-vous sur".$txtblc_fin."<BR>
                <A href=\"<A href="http://www.alfa.fr\">".$txtblc."http://www.allegromusique.fr".$txtblc_fin."</A></TD">http://www.alfa.fr\">".$txtblc."http://www.allegromusique.fr".$txtblc_fin."</A></TD>
              <TD width=40>&nbsp;</TD></TR></TBODY></TABLE><BR></TD>
        <TD width=109 bgcolor=$grisclair></TD></TR></TBODY></TABLE>
    <TABLE cellSpacing=0 cellPadding=0 width=672 border=0>
      <TBODY>
      <TR>
        <TD width=119>&nbsp;</TD>
        <TD vAlign=top>
          <TABLE height=379 cellSpacing=0 cellPadding=0 width=444 border=0>
            <TBODY>
            <TR>
              <TD width=1 bgcolor=$grisclair></TD>
              <TD vAlign=top colSpan=2>
                <TABLE cellSpacing=0 cellPadding=0 width=440 border=0>
                  <TBODY>
                  <TR>
                    <TD width=25>&nbsp;</TD>
                    <TD><BR>".$txtgris.transcript($_POST["entete"]).$txtgris_fin."
                      <TABLE cellSpacing=0 cellPadding=0 width=400 border=0>
                        <TBODY>
                        <TR>
                        ".colonnes()."
                          </TR></TBODY></TABLE>
                      <TABLE cellSpacing=0 cellPadding=0 width=400
                      bgcolor=".$fondgris." border=0>
                        <TBODY>
                        <TR>
                          <TD vAlign=top align=right colSpan=3><IMG
                            height=15 src=\"cid:image5\"
                            width=16></TD></TR>
                        <TR>
                          <TD colSpan=3>&nbsp;&nbsp;&nbsp;".$txtblc
                            .transcript($_POST["titrebas"]).
                            $txtblc_fin."</TD></TR>
                        <TR>
                          <TD colSpan=3 height=\"18\">
                            <HR>
                          </TD></TR>
                        <TR>
                          <TD vAlign=top align=right width=10>&nbsp;</TD>
                          <TD
                          background=
                          colSpan=2>
                            <TABLE >
                              <TBODY ><TD vAlign=top >".$txtblcf.transcript($_POST["pied"]).$txtblcf_fin."</TD></TBODY></TABLE></TD></TR></TBODY></TABLE>
                      <DIV align=center><BR><IMG height=35
                      src=\"cid:image3\"
    width=214><BR><BR></DIV></TD>
                    <TD width=10>&nbsp;</TD></TR></TBODY></TABLE></TD></TR>
            <TR>
              <TD width=1 bgclor=$grisclair height=1></TD>
              <TD bgclor=$grisclair height=1></TD>
              <TD width=150 bgclor=$grisclair
                height=1></TD></TR></TBODY></TABLE></TD>
        <TD vAlign=top width=109 bgcolor=$grisclair><A
          href=\"<a href="http://www.alfa.fr/popv2.htm" target="_blank">http://www.alfa.fr/popv2.htm\</a>" target=_blank><IMG height=58
          alt=\"Faites-vous appeler gratuitement\" src=\"cid:image6\"
          width=109 border=0></A><BR>
          <TABLE cellSpacing=0 cellPadding=0 width=108 border=0>
            <TBODY>
            <TR>
              <TD width=10>&nbsp;</TD>
              <TD>".$textecourant2."Un conseiller <BR>pédagogique <BR>est à
                l’ecoute <BR><A href=\"<a href="http://www.alfa.fr/popv2.htm" target="_blank">http://www.alfa.fr/popv2.htm\</a>" target=_blank>".
                $lienrouge."cliquez
          ici".$lienrouge_fin."</A></TD></TR></TBODY></TABLE><BR><A
          href=\"<A href="http://www.alfa.fr/contact.html\"><IMG">http://www.alfa.fr/contact.html\"><IMG
          height=58 src=\"cid:image7\" width=109 border=0></A>
          <TABLE cellSpacing=0 cellPadding=0 width=108 border=0>
            <TBODY>
            <TR>
              <TD width=10>&nbsp;</TD>
              <TD>".$textecourant2."Vous souhaitez<BR>recevoir une
                documentation, <BR><A href=\"<a href="http://www.alfa.fr/contact.html" target="_blank">http://www.alfa.fr/contact.html\</a>">".
                $lienrouge."cliquez ici".$lienrouge_fin."</A></TD></TR></TBODY></TABLE><BR><A
          href=\"<A href="http://www.alfa.fr/inscription.php\"><IMG">http://www.alfa.fr/inscription.php\"><IMG
          height=58 src=\"cid:image8\" width=109 border=0></A><BR>
          <TABLE cellSpacing=0 cellPadding=0 width=108 border=0>
            <TBODY>
            <TR>
              <TD width=10>&nbsp;</TD>
              <TD>".$textecourant2."Vous souhaitez<BR>vous inscrire, <BR>
              <A href=\"<a href="http://www.alfa.fr/inscription.php" target="_blank">http://www.alfa.fr/inscription.php\</a>">".
              $lienrouge."cliquez ici".$lienrouge_fin."
              </A></TD></TR></TBODY></TABLE>
          <P>&nbsp;</P></TD></TR></TBODY></TABLE>
    <TABLE cellSpacing=0 cellPadding=0 width=688 border=0>
      <TBODY>
      <TR>
        <TD height=20>
          <DIV align=center>".$textecourant2."Vous ne souhaitez plus recevoir la newsletter, "
          ."<A href=\"<a href="http://www.alfa.fr/desabonner.html" target="_blank">http://www.alfa.fr/desabonner.html\</a>">".
          $lienrouge."desabonnez-vous".$lienrouge_fin."</A></DIV></TD>
        <TD width=16 bgcolor=$fondgris></TD></TR></TBODY></TABLE></BODY></HTML>"; 
        $msg .= "\r\n";
     
     
    $fichier = "images/logo.gif";
    $fp      = fopen($fichier, "rb");
    $fichierattache = fread($fp, filesize($fichier));
    fclose($fp);
    $fichierattache = chunk_split(base64_encode($fichierattache));
     
    $msg .= "--$delimiteur\r\n";
    $msg .= "Content-Type: application/octet-stream; name=\"$fichier\"\r\n";
    $msg .= "Content-Transfer-Encoding: base64\r\n";
    $msg .= "Content-ID: <image1>\r\n";
    $msg .= "\r\n"; 
    $msg .= $fichierattache . "\r\n";
    $msg .= "\r\n\r\n";
    $fichier1 = "images/signature.gif";
    $fp      = fopen($fichier1, "rb");
    $fichierattache1 = fread($fp, filesize($fichier1));
    fclose($fp);
    $fichierattache1 = chunk_split(base64_encode($fichierattache1));
     
    $msg .= "--$delimiteur\r\n";
    $msg .= "Content-Type: application/octet-stream; name=\"$fichier1\"\r\n";
    $msg .= "Content-Transfer-Encoding: base64\r\n";
    $msg .= "Content-ID: <image2>\r\n";
    $msg .= "\r\n"; 
    $msg .= $fichierattache1 . "\r\n";
    $msg .= "\r\n\r\n";
    $fichier2 = "images/azur2.gif";
    $fp      = fopen($fichier2, "rb");
    $fichierattache2 = fread($fp, filesize($fichier2));
    fclose($fp);
    $fichierattache2 = chunk_split(base64_encode($fichierattache2));
    $msg .= "--$delimiteur\r\n";
    $msg .= "Content-Type: application/octet-stream; name=\"$fichier2\"\r\n";
    $msg .= "Content-Transfer-Encoding: base64\r\n";
    $msg .= "Content-ID: <image3>\r\n";
    $msg .= "\r\n"; 
    $msg .= $fichierattache2 . "\r\n";
    $msg .= "\r\n\r\n";
    $fichier3 = "images/fondnews.gif";
    $fp      = fopen($fichier3, "rb");
    $fichierattache3 = fread($fp, filesize($fichier3));
    fclose($fp);
    $fichierattache3 = chunk_split(base64_encode($fichierattache3));
    $msg .= "--$delimiteur\r\n";
    $msg .= "Content-Type: application/octet-stream; name=\"$fichier3\"\r\n";
    $msg .= "Content-Transfer-Encoding: base64\r\n";
    $msg .= "Content-ID: <image4>\r\n";
    $msg .= "\r\n"; 
    $msg .= $fichierattache3 . "\r\n";
    $msg .= "\r\n\r\n";
    $fichier4 = "images/coingrismoy.gif";
    $fp      = fopen($fichier4, "rb");
    $fichierattache4 = fread($fp, filesize($fichier4));
    fclose($fp);
    $fichierattache4 = chunk_split(base64_encode($fichierattache4));
    $msg .= "--$delimiteur\r\n";
    $msg .= "Content-Type: application/octet-stream; name=\"$fichier4\"\r\n";
    $msg .= "Content-Transfer-Encoding: base64\r\n";
    $msg .= "Content-ID: <image5>\r\n";
    $msg .= "\r\n"; 
    $msg .= $fichierattache4 . "\r\n";
    $msg .= "\r\n\r\n";
    $fichier5 = "images/appel.gif";
    $fp      = fopen($fichier5, "rb");
    $fichierattache5 = fread($fp, filesize($fichier5));
    fclose($fp);
    $fichierattache5 = chunk_split(base64_encode($fichierattache5));
    $msg .= "--$delimiteur\r\n";
    $msg .= "Content-Type: application/octet-stream; name=\"$fichier5\"\r\n";
    $msg .= "Content-Transfer-Encoding: base64\r\n";
    $msg .= "Content-ID: <image6>\r\n";
    $msg .= "\r\n"; 
    $msg .= $fichierattache5 . "\r\n";
    $msg .= "\r\n\r\n";
    $fichier6 = "images/doc.gif";
    $fp      = fopen($fichier6, "rb");
    $fichierattache6 = fread($fp, filesize($fichier6));
    fclose($fp);
    $fichierattache6 = chunk_split(base64_encode($fichierattache6));
    $msg .= "--$delimiteur\r\n";
    $msg .= "Content-Type: application/octet-stream; name=\"$fichier6\"\r\n";
    $msg .= "Content-Transfer-Encoding: base64\r\n";
    $msg .= "Content-ID: <image7>\r\n";
    $msg .= "\r\n"; 
    $msg .= $fichierattache6 . "\r\n";
    $msg .= "\r\n\r\n";
    $fichier7 = "images/inscr.gif";
    $fp      = fopen($fichier7, "rb");
    $fichierattache7 = fread($fp, filesize($fichier7));
    fclose($fp);
    $fichierattache7 = chunk_split(base64_encode($fichierattache7));
    $msg .= "--$delimiteur\r\n";
    $msg .= "Content-Type: application/octet-stream; name=\"$fichier7\"\r\n";
    $msg .= "Content-Transfer-Encoding: base64\r\n";
    $msg .= "Content-ID: <image8>\r\n";
    $msg .= "\r\n"; 
    $msg .= $fichierattache7 . "\r\n";
    $msg .= "\r\n\r\n";
     
    $expediteur   = "<a href="mailto:noreply@alfa.fr">noreply@alfa.fr</a>";
    $reponse      = $expediteur;
     
    // D'autres en-têtes : errors, From cc's, bcc's, etc :
    // Pour envoyer du mail au format html, vous pouvez configurer le type content-type : 
    mail($add,
         $subject,
         $msg,
         "Reply-to: $reponse\r\nFrom: $expediteur\r\n".$headers);
    ?>

  2. #2
    Membre chevronné
    Avatar de Bidouille
    Inscrit en
    Mars 2003
    Messages
    1 281
    Détails du profil
    Informations forums :
    Inscription : Mars 2003
    Messages : 1 281
    Points : 1 999
    Points
    1 999
    Par défaut
    Au lieu de balancer 500 lignes de code, utilise la classe PhpMailer.

  3. #3
    Membre à l'essai
    Profil pro
    Inscrit en
    Avril 2006
    Messages
    27
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Avril 2006
    Messages : 27
    Points : 12
    Points
    12
    Par défaut
    comment sa fonctionne phpmailer?

Discussions similaires

  1. Intégration mailing xHTML avec Gmail
    Par malayika dans le forum Balisage (X)HTML et validation W3C
    Réponses: 1
    Dernier message: 09/02/2011, 21h47
  2. Problème d'envoi de mail vers boite gmail
    Par Pedro dans le forum PHP & Base de données
    Réponses: 5
    Dernier message: 07/12/2009, 20h29
  3. [PHP 5.0] Function mail et la Gmail
    Par Shandler dans le forum Langage
    Réponses: 1
    Dernier message: 25/11/2009, 22h32
  4. [PEAR][Mail] Mail qui ne s'affiche pas sur gmail
    Par zevince dans le forum Bibliothèques et frameworks
    Réponses: 1
    Dernier message: 21/11/2007, 15h24
  5. [Mail] envoi d'un mail, problème avec gmail
    Par kitty2006 dans le forum Langage
    Réponses: 11
    Dernier message: 30/09/2006, 08h45

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