Forum |  HardWare.fr | News | Articles | PC | S'identifier | S'inscrire | Shop Recherche
1173 connectés 

  FORUM HardWare.fr
  Programmation
  PHP

  Problème fonction mail()

 


 Mot :   Pseudo :  
 
Bas de page
Auteur Sujet :

Problème fonction mail()

n°2088176
boss183
Posté le 08-07-2011 à 11:59:31  profilanswer
 

Bonjour à tous,
 
j'ai un problème avec ma fonction d'envoi de mail, lorsque je reçois un mail automatiquement grâce à la fonction PHP, l'adresse d'envoi est "toto@gmail.com"@localhost.localdomain en sachant que toto@gmail.com correspond à l'adresse que j'ai rentré dans ma variable "sendfrom". Je n'ai pas le problème lorsque mes scripts PHP tournent sur un serveur apache sous Windows, mais je viens de rencontrer le problème lorsqu'ils tournent sur un serveur apache sous une VM CentOS. Ci-dessous ma fonction d'envoi de mail :
 

Code :
  1. // Envoi automatique du mail de notification
  2. function Send_Mail($src, $dest, $login, $pass, $prenom, $nom)
  3. {
  4. //ini_set("SMTP","192.168.98.15" );
  5. global $objnotife, $msgnotife, $objnotifd, $msgnotifd, $sendmailfrom, $replyto;
  6. $destinataire = analyse_mail($dest);
  7. if (is_array($destinataire))
  8. {
  9.  $msgnotife = str_replace("[LOGIN]",$login,$msgnotife);
  10.  $msgnotife = str_replace("[PASS]",$pass,$msgnotife);
  11.  $msgnotife = str_replace("[DEST]",$dest,$msgnotife);
  12.  $msgnotife = str_replace("[SRC]",$src,$msgnotife);
  13.  $msgnotife = str_replace("[PRENOM]",$prenom,$msgnotife);
  14.  $msgnotife = str_replace("[NOM]",$nom,$msgnotife);
  15.  $msgnotifd = str_replace("[LOGIN]",$login,$msgnotifd);
  16.  $msgnotifd = str_replace("[PASS]",$pass,$msgnotifd);
  17.  $msgnotifd = str_replace("[DEST]",$dest,$msgnotifd);
  18.  $msgnotifd = str_replace("[SRC]",$src,$msgnotifd);
  19.  $msgnotifd = str_replace("[PRENOM]",$prenom,$msgnotifd);
  20.  $msgnotifd = str_replace("[NOM]",$nom,$msgnotifd);
  21.  $objnotifd = str_replace("[PRENOM]",ucwords($prenom),$objnotifd);
  22.  $objnotifd = str_replace("[NOM]",strtoupper($nom),$objnotifd);
  23.  if (mail($src, stripslashes($objnotife), "
  24.         <html><body>".stripslashes($msgnotife)."</body></html>
  25.         ", "Content-type:text/html\nFrom: $sendmailfrom\r\nReply-to:$replyto" ))
  26.  {
  27.   $Ret=1;
  28.   foreach ($destinataire as $des)
  29.   {
  30.    if (mail($des, stripslashes($objnotifd), "
  31.                         <html><body>".stripslashes($msgnotifd)."</body></html>
  32.                         ", "Content-type:text/html\nFrom: $sendmailfrom\r\nReply-to:$src" ))
  33.     $Ret=1;
  34.    else
  35.     $Ret=0;
  36.   }
  37.  }
  38.  else
  39.   $Ret=0;
  40. }
  41. else
  42.  $Ret = 0;
  43. return $Ret;
  44. }


 
Merci d'avance

mood
Publicité
Posté le 08-07-2011 à 11:59:31  profilanswer
 

n°2088182
hpl76
Fucked with a Knife !
Posté le 08-07-2011 à 12:18:11  profilanswer
 

Salut,
 
Et j'imagine que tu rencontres des soucis de réception, spam and co, vrai ?
 
donc la soluce est ici : http://www.geekology.co.za/blog/20 [...] -php-mail/
 
Même si tu as un return-path correct, ca marche pas forcément donc force le avec -f sender@domain.com dans la fonction mail php finale.
 
Ca marche ;)


---------------
T'as pas de couilles au cul et quand tu en as c'est pas les tiennes :)
n°2088246
boss183
Posté le 08-07-2011 à 15:39:11  profilanswer
 

J'ai essayé de modifier ma fonction, maintenant j'ai le problème sous Outlook mais pas sous hotmail ?!?!

n°2092165
janhsh
Posté le 29-07-2011 à 17:16:25  profilanswer
 

Va voir  http://www.phpcs.com/codes/CLASSE- [...] 44094.aspx
Ca fonctione très bien, très complet et facile à utiliser..
le top pour l'envoi des mails


Aller à :
Ajouter une réponse
  FORUM HardWare.fr
  Programmation
  PHP

  Problème fonction mail()

 

Sujets relatifs
probleme avec la fonction mailProblème fonction mail
probleme caractere (fonction mail)Problème de SMTP avec la fonction mail() et Yahoo
Problème avec la fonction mail()[RESOLU] Problème avec la fonction mail()
Probleme fonction mailProbleme securite fonction mail php
Probleme avec la fonction mailProblème envoi mail avec fonction mail() [Résolu]
Plus de sujets relatifs à : Problème fonction mail()


Copyright © 1997-2022 Hardware.fr SARL (Signaler un contenu illicite / Données personnelles) / Groupe LDLC / Shop HFR