PHP : Problème avec fonction mail()
boss183
Messages postés
181
Date d'inscription
Statut
Membre
Dernière intervention
-
boss183 Messages postés 181 Date d'inscription Statut Membre Dernière intervention -
boss183 Messages postés 181 Date d'inscription Statut Membre Dernière intervention -
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 :
Merci d'avance
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 :
// Envoi automatique du mail de notification function Send_Mail($src, $dest, $login, $pass, $prenom, $nom) { //ini_set("SMTP","192.168.98.15" ); global $objnotife, $msgnotife, $objnotifd, $msgnotifd, $sendmailfrom, $replyto; $destinataire = analyse_mail($dest); if (is_array($destinataire)) { $msgnotife = str_replace("[LOGIN]",$login,$msgnotife); $msgnotife = str_replace("[PASS]",$pass,$msgnotife); $msgnotife = str_replace("[DEST]",$dest,$msgnotife); $msgnotife = str_replace("[SRC]",$src,$msgnotife); $msgnotife = str_replace("[PRENOM]",$prenom,$msgnotife); $msgnotife = str_replace("[NOM]",$nom,$msgnotife); $msgnotifd = str_replace("[LOGIN]",$login,$msgnotifd); $msgnotifd = str_replace("[PASS]",$pass,$msgnotifd); $msgnotifd = str_replace("[DEST]",$dest,$msgnotifd); $msgnotifd = str_replace("[SRC]",$src,$msgnotifd); $msgnotifd = str_replace("[PRENOM]",$prenom,$msgnotifd); $msgnotifd = str_replace("[NOM]",$nom,$msgnotifd); $objnotifd = str_replace("[PRENOM]",ucwords($prenom),$objnotifd); $objnotifd = str_replace("[NOM]",strtoupper($nom),$objnotifd); if (mail($src, stripslashes($objnotife), " <html><body>".stripslashes($msgnotife)."</body></html> ", "Content-type:text/html\nFrom: $sendmailfrom\r\nReply-to:$replyto")) { $Ret=1; foreach ($destinataire as $des) { if (mail($des, stripslashes($objnotifd), " <html><body>".stripslashes($msgnotifd)."</body></html> ", "Content-type:text/html\nFrom: $sendmailfrom\r\nReply-to:$src")) $Ret=1; else $Ret=0; } } else $Ret=0; } else $Ret = 0; return $Ret; }
Merci d'avance
A voir également:
- PHP : Problème avec fonction mail()
- Easy php - Télécharger - Divers Web & Internet
- Expert php pinterest - Télécharger - Langages
- Retour a la ligne php - Forum Webmastering
- Alert php - Forum PHP
- Retour a la ligne php ✓ - Forum PHP
2 réponses
bah je la récupère ailleurs, par conter j'ai modifié ma fonction et j'ai le problème sous outlook et pas sur hotmail
if (is_array($destinataire)) { $msgnotife = str_replace("[LOGIN]",$login,$msgnotife); $msgnotife = str_replace("[PASS]",$pass,$msgnotife); $msgnotife = str_replace("[DEST]",$dest,$msgnotife); $msgnotife = str_replace("[SRC]",$src,$msgnotife); $msgnotife = str_replace("[PRENOM]",$prenom,$msgnotife); $msgnotife = str_replace("[NOM]",$nom,$msgnotife); $msgnotifd = str_replace("[LOGIN]",$login,$msgnotifd); $msgnotifd = str_replace("[PASS]",$pass,$msgnotifd); $msgnotifd = str_replace("[DEST]",$dest,$msgnotifd); $msgnotifd = str_replace("[SRC]",$src,$msgnotifd); $msgnotifd = str_replace("[PRENOM]",$prenom,$msgnotifd); $msgnotifd = str_replace("[NOM]",$nom,$msgnotifd); $objnotifd = str_replace("[PRENOM]",ucwords($prenom),$objnotifd); $objnotifd = str_replace("[NOM]",strtoupper($nom),$objnotifd); $headers ="Content-type:text/html\r\n"; $headers .="From:test <\"$sendmailfrom\">\r\n"; $headers .="Return-Path:\"$replyto\"\r\n"; if (mail($src, stripslashes($objnotife), "<html><body>".stripslashes($msgnotife)."</body></html>", $headers, "-f \"$replyto\"")) { $Ret=1; foreach ($destinataire as $des) { if (mail($des, stripslashes($objnotifd), "<html><body>".stripslashes($msgnotifd)."</body></html>", $headers, "-f \"$replyto\"")) $Ret=1; else $Ret=0; } } else $Ret=0; } else $Ret = 0; return $Ret; }