Problême avec PHPmailer

Fermé
sly_prod Messages postés 26 Date d'inscription jeudi 26 février 2009 Statut Membre Dernière intervention 12 novembre 2010 - 14 déc. 2009 à 17:15
sly_prod Messages postés 26 Date d'inscription jeudi 26 février 2009 Statut Membre Dernière intervention 12 novembre 2010 - 15 déc. 2009 à 19:25
Bonjour,à tous, j'ai un soucis avec php mailer.

je m'explique,
j'ai fais un site internet, depuis ce site, j'ai fais un formulaire pour que l'utilisateur m'envois un mail via phpmailer et mon smtp ovh.

pour les adeptes, je vous met les 200 premières lignes de ma class phpmailer


////////////////////////////////////////////////////
// PHPMailer - PHP email class
//
// Class for sending email using either
// sendmail, PHP mail(), or SMTP.  Methods are
// based upon the standard AspEmail(tm) classes.
//
// Copyright (C) 2001 - 2003  Brent R. Matzelle
//
// License: LGPL, see LICENSE
////////////////////////////////////////////////////

/**
 * PHPMailer - PHP email transport class
 * @package PHPMailer
 * @author Brent R. Matzelle
 * @copyright 2001 - 2003 Brent R. Matzelle
 */
class PHPMailer
{
    /////////////////////////////////////////////////
    // PUBLIC VARIABLES
    /////////////////////////////////////////////////

    /**
     * Email priority (1 = High, 3 = Normal, 5 = low).
     * @var int
     */
    var $Priority          = 3;

    /**
     * Sets the CharSet of the message.
     * @var string
     */
    var $CharSet           = "iso-8859-1";

    /**
     * Sets the Content-type of the message.
     * @var string
     */
    var $ContentType        = "text/plain";

    /**
     * Sets the Encoding of the message. Options for this are "8bit",
     * "7bit", "binary", "base64", and "quoted-printable".
     * @var string
     */
    var $Encoding          = "8bit";

    /**
     * Holds the most recent mailer error message.
     * @var string
     */
    var $ErrorInfo         = "";

    /**
     * Sets the From email address for the message.
     * @var string
     */
    var $From               = "postmaster@***.fr";

    /**
     * Sets the From name of the message.
     * @var string
     */
    var $FromName           = "***";

    /**
     * Sets the Sender email (Return-Path) of the message.  If not empty,
     * will be sent via -f to sendmail or as 'MAIL FROM' in smtp mode.
     * @var string
     */
    var $Sender            = "";

    /**
     * Sets the Subject of the message.
     * @var string
     */
    var $Subject           = "";

    /**
     * Sets the Body of the message.  This can be either an HTML or text body.
     * If HTML then run IsHTML(true).
     * @var string
     */
    var $Body               = "";

    /**
     * Sets the text-only body of the message.  This automatically sets the
     * email to multipart/alternative.  This body can be read by mail
     * clients that do not have HTML email capability such as mutt. Clients
     * that can read HTML will view the normal Body.
     * @var string
     */
    var $AltBody           = "";

    /**
     * Sets word wrapping on the body of the message to a given number of 
     * characters.
     * @var int
     */
    var $WordWrap          = 0;

    /**
     * Method to send mail: ("mail", "sendmail", or "smtp").
     * @var string
     */
    var $Mailer            = "mail";

    /**
     * Sets the path of the sendmail program.
     * @var string
     */
    var $Sendmail          = "/usr/sbin/sendmail";
    
    /**
     * Path to PHPMailer plugins.  This is now only useful if the SMTP class 
     * is in a different directory than the PHP include path.  
     * @var string
     */
    var $PluginDir         = "";

    /**
     *  Holds PHPMailer version.
     *  @var string
     */
    var $Version           = "1.71";

    /**
     * Sets the email address that a reading confirmation will be sent.
     * @var string
     */
    var $ConfirmReadingTo  = "";

    /**
     *  Sets the hostname to use in Message-Id and Received headers
     *  and as default HELO string. If empty, the value returned
     *  by SERVER_NAME is used or 'localhost.localdomain'.
     *  @var string
     */
    var $Hostname          = "";


    /////////////////////////////////////////////////
    // SMTP VARIABLES
    /////////////////////////////////////////////////

    /**
     *  Sets the SMTP hosts.  All hosts must be separated by a
     *  semicolon.  You can also specify a different port
     *  for each host by using this format: [hostname:port]
     *  (e.g. "smtp1.example.com:25;smtp2.example.com").
     *  Hosts will be tried in order.
     *  @var string
     */
    var $Host        = "localhost";

    /**
     *  Sets the default SMTP server port.
     *  @var int
     */
    var $Port        = 465;

    /**
     *  Sets the SMTP HELO of the message (Default is $Hostname).
     *  @var string
     */
    var $Helo        = "";

    /**
     *  Sets SMTP authentication. Utilizes the Username and Password variables.
     *  @var bool
     */
    var $SMTPAuth     = false;

    /**
     *  Sets SMTP username.
     *  @var string
     */
    var $Username     = "";

    /**
     *  Sets SMTP password.
     *  @var string
     */
    var $Password     = "";

    /**
     *  Sets the SMTP server timeout in seconds. This function will not 
     *  work with the win32 version.
     *  @var int
     */
    var $Timeout      = 10;

    /**
     *  Sets SMTP class debugging on or off.
     *  @var bool
     */


les premières de ma class smtp

<?php
////////////////////////////////////////////////////
// SMTP - PHP SMTP class
//
// Version 1.02
//
// Define an SMTP class that can be used to connect
// and communicate with any SMTP server. It implements
// all the SMTP functions defined in RFC821 except TURN.
//
// Author: Chris Ryan
//
// License: LGPL, see LICENSE
////////////////////////////////////////////////////

/**
 * SMTP is rfc 821 compliant and implements all the rfc 821 SMTP
 * commands except TURN which will always return a not implemented
 * error. SMTP also provides some utility methods for sending mail
 * to an SMTP server.
 * @package PHPMailer
 * @author Chris Ryan
 */
class SMTP
{
    /**
     *  SMTP server port
     *  @var int
     */
    var $SMTP_PORT = 465;
    
    /**
     *  SMTP reply line ending
     *  @var string
     */
    var $CRLF = "\r\n";
    
    /**
     *  Sets whether debugging is turned on
     *  @var bool
     */
    var $do_debug;       # the level of debug to perform

    /**#@+
     * @access private
     */
    var $smtp_conn;      # the socket to the server
    var $error;          # error if any on the last call
    var $helo_rply;      # the reply the server sent to us for HELO
    /**#@-*/

    /**
     * Initialize the class so that the data is in a known state.
     * @access public
     * @return void
     */
    function SMTP() {
        $this->smtp_conn = 0;
        $this->error = null;
        $this->helo_rply = null;

        $this->do_debug = 0;
    }


et enfin ma page envoi.php

<?php
session_start();
require "phpmailer/class.phpmailer.php";
$nomsociete			=	$_SESSION['nomsociete'];
$nom				=	$_SESSION['nom'];
$prenom				=	$_SESSION['prenom'];

$mail1				=	$_SESSION['mail'];
$tel				=	$_SESSION['tel'];
$sujet				=	$_SESSION['sujet'];
$message			=	$_SESSION['message'];

$mail = new PHPmailer();
$mail->SetLanguage("en", "phpmailer/language/"); 
$mail->IsSMTP();
$mail->IsHTML(true);

$mail->Host="ssl0.ovh.net";
	$mail->SMTPAuth = true;
	$mail->Username="postmaster@******.fr";
	$mail->Password="********";

$mail->From="$mail1";
$mail->AddAddress('monadresse@gmail.com');
$mail->AddReplyTo('$mail1');	
$mail->Subject='$sujet';	
$mail->Body='
	<html>		
	</head>
	<body>
	<h2>Message provenant du site SlyProd</h2>		
	<p>'.$sujet.'</p>
	<p>Nom de ma société:'.$nomsociete.'</p>
	<p>je m\'appelle '.$nom.' '.$prenom.', on peu me joindre au '.$tel.' et mon message est le suivant<p>
	<p>'.$message.'</p>
	</body>
	</html>';	
	
	if(!$mail->Send())
	{ 
	  echo "<p>tu es la</p>";	
	  echo $mail->ErrorInfo;
	
	  
	}
	else{	  
	  echo "<p>Mail envoyé avec succès à moi</p>";
	}
	$mail->SmtpClose();
	unset($mail);
?>



vous pouvez testé le résultat en cliquant http://slyprod.fr/slyprod/index.php?page=contact1

Quelqun'un peut m'aider?

1 réponse

sly_prod Messages postés 26 Date d'inscription jeudi 26 février 2009 Statut Membre Dernière intervention 12 novembre 2010
15 déc. 2009 à 19:25
quelqu'un a une idée?
0