SMTP mail avec PEAR et Wampserver?

  • mindfullsilence
  • Professor
  • Professor
  • Avatar de l’utilisateur
  • Inscription: Aoû 04, 2008
  • Messages: 846
  • Status: Offline

Message Juin 24th, 2009, 9:44 pm

honnêtement, Ive été à travailler sur ce pendant des jours et ont reçu nulle part. Aucune idée de ce que d'écrire du code, aucune idée de comment l'obtenir de lui envoyer, aucune idée d'où j'ai quitté mon cerveau quand il a fui de ma tête.

Id code post pour vous les gars à regarder, mais je n'ai pas, comme je l'ai dit, rien ne fonctionne, ni même à proximité.

J'ai besoin d'un formulaire sur ce site: http://173.11.86.101/voltec/ pour écrire à un fichier php qui fonctionne avec des poires mail addon.

Ive a examiné environ 20 différents sites, de lire les tutoriaux bogey posté ici, ainsi que 10 - 15 Tuts ailleurs. Toute aide les gars?
Use your words like arrows to shoot toward your goal.
  • Anonymous
  • Bot
  • No Avatar
  • Inscription: 25 Feb 2008
  • Messages: ?
  • Loc: Ozzuland
  • Status: Online

Message Juin 24th, 2009, 9:44 pm

  • Bogey
  • Bogey
  • Genius
  • Avatar de l’utilisateur
  • Inscription: Juil 14, 2005
  • Messages: 8211
  • Loc: USA
  • Status: Offline

Message Juin 24th, 2009, 10:27 pm

Montrez-moi le mail de PEAR addon...pouvez-vous expliquer le problème un peu plus? Qu'est-ce qui vous...ces choses que vous voulez dans le formulaire qui vous est envoyé par e-mail?

Je peux vous envoyer le SMTP de classe et que je me suis un peu modifié...il fonctionne parfaitement. (Je l'utiliser pour envoyer la vérification des comptes, contactez-moi, ou un utilisateur à l'envoi de courrier électronique et mes autres besoins emailing).


Il semble que les poires mail addon est absent au moins une dépendance. (Mail.php demandé dans sendemail.php).
"Bring forth therefore fruits meet for repentance:" Matthew 3:8
  • mindfullsilence
  • Professor
  • Professor
  • Avatar de l’utilisateur
  • Inscription: Aoû 04, 2008
  • Messages: 846
  • Status: Offline

Message Juin 24th, 2009, 10:45 pm

Je crois cet est la poire thats paquet installé

php 5, la nouvelle version stable.

oui, je veux que les données de formulaire à envoyer à un e-mail par l'intermédiaire d'un serveur SMTP lors de l'utilisateur hits soumettre.
Use your words like arrows to shoot toward your goal.
  • Bogey
  • Bogey
  • Genius
  • Avatar de l’utilisateur
  • Inscription: Juil 14, 2005
  • Messages: 8211
  • Loc: USA
  • Status: Offline

Message Juin 24th, 2009, 10:58 pm

La classe SMTP que j'utilise est...

Code: [ Select ]
<?php
// Mail.php
class mail
{
    private $smtpServer = 'smtp.site.com';
    private $port = '25';
    private $timeout = 30;
    private $username = 'smtp_user';
    private $password = 'smtp_pass';
    private $username_email = 'admin@site.com';
    private $newline = "\r\n";
    private $localdomain = 'site.com';
    private $charset = 'windows-1251';
    private $contentTransferEncoding = false;
 
    // Do not change anything below
    private $smtpConnect = false;
    private $to = false;
    private $subject = false;
    private $message = false;
    private $headers = false;
    private $logArray = array(); // Array response message for debug
    private $Error = '';
 
    public function __construct($to, $subject, $message, $to2 = false) {
        $this->to = (($to2 !== false)? $this->username_email : $to);
        $this->subject = &$subject;
        $this->message = &$message;
       
        // Connect to server
        if(!$this->Connect2Server()) {
            // Display error message
            echo '<pre>'.trim($this->Error).'</pre>'.$this->newline.'<!-- '.$this->newline;
            print_r($this->logArray);
            echo $this->newline.'-->'.$this->newline;
            return false;
        }
        return true;
    }
 
    private function Connect2Server() {
        $from = (($to2 == false)? $this->username_email : $to);
       
        // Connect to server
        $this->smtpConnect = fsockopen($this->smtpServer,$this->port,$errno,$error,$this->timeout);
        $this->logArray['CONNECT_RESPONSE'] = $this->readResponse();
 
        if (!is_resource($this->smtpConnect)) {
            return false;
        }
        $this->logArray['connection'] = "Connection accepted: {$smtpResponse}";
        // Hi, server!
        $this->sendCommand("HELO {$this->localdomain}");
        $this->logArray['HELO'] = $this->readResponse();
        // Let's know each other
        $this->sendCommand('AUTH LOGIN');
        $this->logArray['AUTH_REQUEST'] = $this->readResponse();
        // My name...
        $this->sendCommand(base64_encode($this->username));
        $this->logArray['REQUEST_USER'] = $this->readResponse();
        // My password..
        $this->sendCommand(base64_encode($this->password));
        $this->logArray['REQUEST_PASSWD'] = $this->readResponse();
        // If error in response auth...
        if (substr($this->logArray['REQUEST_PASSWD'],0,3)!='235') {
            $this->Error .= 'Authorization error! '.$this->logArray['REQUEST_PASSWD'].$this->newline;
            return false;
        }
        // "From" mail...
        $this->sendCommand("MAIL FROM: {$from}");
        $this->logArray['MAIL_FROM_RESPONSE'] = $this->readResponse();
        if (substr($this->logArray['MAIL_FROM_RESPONSE'],0,3)!='250') {
            $this->Error .= 'Mistake in sender\'s address! '.$this->logArray['MAIL_FROM_RESPONSE'].$this->newline;
            return false;
        }
        // "To" address
        $this->sendCommand("RCPT TO: {$this->to}");
        $this->logArray['RCPT_TO_RESPONCE'] = $this->readResponse();
        if(substr($this->logArray['RCPT_TO_RESPONCE'],0,3) != '250')
        {
            $this->Error .= 'Mistake in reciepent address! '.$this->logArray['RCPT_TO_RESPONCE'].$this->newline;
        }
        // Send data to server
        $this->sendCommand('DATA');
        $this->logArray['DATA_RESPONSE'] = $this->readResponse();
        // Send mail message
        if (!$this->sendMail()) return false;
        // Good bye server! =)
        $this->sendCommand('QUIT');
        $this->logArray['QUIT_RESPONSE'] = $this->readResponse();
        // Close smtp connect
        fclose($this->smtpConnect);
        return true;
    }
    // Function send mail
    private function sendMail() {
        $this->sendHeaders();
        $this->sendCommand($this->message);
        $this->sendCommand('.');
        $this->logArray['SEND_DATA_RESPONSE'] = $this->readResponse();
        if(substr($this->logArray['SEND_DATA_RESPONSE'],0,3)!='250') {
            $this->Error .= 'Mistake in sending data! '.$this->logArray['SEND_DATA_RESPONSE'].$this->newline;
            return false;
        }
        return true;
    }
    // Function read response
    private function readResponse() {
        $data="";
        while($str = fgets($this->smtpConnect,4096))
        {
            $data .= $str;
            if(substr($str,3,1) == " ") { break; }
        }
        return $data;
    }
    // function send command to server
    private function sendCommand($string) {
        fputs($this->smtpConnect,$string.$this->newline);
        return ;
    }
    // function send headers
    private function sendHeaders() {
        $from = (($to2 == false)? $this->username_email : $to);
        $this->sendCommand("Date: ".date("D, j M Y G:i:s")." +0700");
        $this->sendCommand("From: <{$from}>");
        $this->sendCommand("Reply-To: <{$from}>");
        $this->sendCommand("To: <{$this->to}>");
        $this->sendCommand("Subject: {$this->subject}");
        $this->sendCommand("MIME-Version: 1.0");
        $this->sendCommand("Content-Type: text/html; charset={$this->charset}");
        if ($this->contentTransferEncoding) $this->sendCommand("Content-Transfer-Encoding: {$this->contentTransferEncoding}");
        return ;
    }
 
    public function __destruct() {
        if (is_resource($this->smtpConnect)) fclose($this->smtpConnect);
    }
}
?>
  1. <?php
  2. // Mail.php
  3. class mail
  4. {
  5.     private $smtpServer = 'smtp.site.com';
  6.     private $port = '25';
  7.     private $timeout = 30;
  8.     private $username = 'smtp_user';
  9.     private $password = 'smtp_pass';
  10.     private $username_email = 'admin@site.com';
  11.     private $newline = "\r\n";
  12.     private $localdomain = 'site.com';
  13.     private $charset = 'windows-1251';
  14.     private $contentTransferEncoding = false;
  15.  
  16.     // Do not change anything below
  17.     private $smtpConnect = false;
  18.     private $to = false;
  19.     private $subject = false;
  20.     private $message = false;
  21.     private $headers = false;
  22.     private $logArray = array(); // Array response message for debug
  23.     private $Error = '';
  24.  
  25.     public function __construct($to, $subject, $message, $to2 = false) {
  26.         $this->to = (($to2 !== false)? $this->username_email : $to);
  27.         $this->subject = &$subject;
  28.         $this->message = &$message;
  29.        
  30.         // Connect to server
  31.         if(!$this->Connect2Server()) {
  32.             // Display error message
  33.             echo '<pre>'.trim($this->Error).'</pre>'.$this->newline.'<!-- '.$this->newline;
  34.             print_r($this->logArray);
  35.             echo $this->newline.'-->'.$this->newline;
  36.             return false;
  37.         }
  38.         return true;
  39.     }
  40.  
  41.     private function Connect2Server() {
  42.         $from = (($to2 == false)? $this->username_email : $to);
  43.        
  44.         // Connect to server
  45.         $this->smtpConnect = fsockopen($this->smtpServer,$this->port,$errno,$error,$this->timeout);
  46.         $this->logArray['CONNECT_RESPONSE'] = $this->readResponse();
  47.  
  48.         if (!is_resource($this->smtpConnect)) {
  49.             return false;
  50.         }
  51.         $this->logArray['connection'] = "Connection accepted: {$smtpResponse}";
  52.         // Hi, server!
  53.         $this->sendCommand("HELO {$this->localdomain}");
  54.         $this->logArray['HELO'] = $this->readResponse();
  55.         // Let's know each other
  56.         $this->sendCommand('AUTH LOGIN');
  57.         $this->logArray['AUTH_REQUEST'] = $this->readResponse();
  58.         // My name...
  59.         $this->sendCommand(base64_encode($this->username));
  60.         $this->logArray['REQUEST_USER'] = $this->readResponse();
  61.         // My password..
  62.         $this->sendCommand(base64_encode($this->password));
  63.         $this->logArray['REQUEST_PASSWD'] = $this->readResponse();
  64.         // If error in response auth...
  65.         if (substr($this->logArray['REQUEST_PASSWD'],0,3)!='235') {
  66.             $this->Error .= 'Authorization error! '.$this->logArray['REQUEST_PASSWD'].$this->newline;
  67.             return false;
  68.         }
  69.         // "From" mail...
  70.         $this->sendCommand("MAIL FROM: {$from}");
  71.         $this->logArray['MAIL_FROM_RESPONSE'] = $this->readResponse();
  72.         if (substr($this->logArray['MAIL_FROM_RESPONSE'],0,3)!='250') {
  73.             $this->Error .= 'Mistake in sender\'s address! '.$this->logArray['MAIL_FROM_RESPONSE'].$this->newline;
  74.             return false;
  75.         }
  76.         // "To" address
  77.         $this->sendCommand("RCPT TO: {$this->to}");
  78.         $this->logArray['RCPT_TO_RESPONCE'] = $this->readResponse();
  79.         if(substr($this->logArray['RCPT_TO_RESPONCE'],0,3) != '250')
  80.         {
  81.             $this->Error .= 'Mistake in reciepent address! '.$this->logArray['RCPT_TO_RESPONCE'].$this->newline;
  82.         }
  83.         // Send data to server
  84.         $this->sendCommand('DATA');
  85.         $this->logArray['DATA_RESPONSE'] = $this->readResponse();
  86.         // Send mail message
  87.         if (!$this->sendMail()) return false;
  88.         // Good bye server! =)
  89.         $this->sendCommand('QUIT');
  90.         $this->logArray['QUIT_RESPONSE'] = $this->readResponse();
  91.         // Close smtp connect
  92.         fclose($this->smtpConnect);
  93.         return true;
  94.     }
  95.     // Function send mail
  96.     private function sendMail() {
  97.         $this->sendHeaders();
  98.         $this->sendCommand($this->message);
  99.         $this->sendCommand('.');
  100.         $this->logArray['SEND_DATA_RESPONSE'] = $this->readResponse();
  101.         if(substr($this->logArray['SEND_DATA_RESPONSE'],0,3)!='250') {
  102.             $this->Error .= 'Mistake in sending data! '.$this->logArray['SEND_DATA_RESPONSE'].$this->newline;
  103.             return false;
  104.         }
  105.         return true;
  106.     }
  107.     // Function read response
  108.     private function readResponse() {
  109.         $data="";
  110.         while($str = fgets($this->smtpConnect,4096))
  111.         {
  112.             $data .= $str;
  113.             if(substr($str,3,1) == " ") { break; }
  114.         }
  115.         return $data;
  116.     }
  117.     // function send command to server
  118.     private function sendCommand($string) {
  119.         fputs($this->smtpConnect,$string.$this->newline);
  120.         return ;
  121.     }
  122.     // function send headers
  123.     private function sendHeaders() {
  124.         $from = (($to2 == false)? $this->username_email : $to);
  125.         $this->sendCommand("Date: ".date("D, j M Y G:i:s")." +0700");
  126.         $this->sendCommand("From: <{$from}>");
  127.         $this->sendCommand("Reply-To: <{$from}>");
  128.         $this->sendCommand("To: <{$this->to}>");
  129.         $this->sendCommand("Subject: {$this->subject}");
  130.         $this->sendCommand("MIME-Version: 1.0");
  131.         $this->sendCommand("Content-Type: text/html; charset={$this->charset}");
  132.         if ($this->contentTransferEncoding) $this->sendCommand("Content-Transfer-Encoding: {$this->contentTransferEncoding}");
  133.         return ;
  134.     }
  135.  
  136.     public function __destruct() {
  137.         if (is_resource($this->smtpConnect)) fclose($this->smtpConnect);
  138.     }
  139. }
  140. ?>

Le $ smtpServer est le serveur SMTP que vous utilisez. Gmail ne présente, ou vous pouvez utiliser le vôtre si vous en avez un.

Le $ port est le numéro de port du serveur SMTP.

Le $ username est le nom utilisé pour ouvrir une session sur le serveur SMTP.

Le $ password est le mot de passe utilisé avec le nom d'utilisateur à se connecter au serveur SMTP.

Le $ username_email est votre email principal, où le courrier sera envoyé à.

Le $ localdomain est votre domaine.

Et de l'utiliser avec vos informations...
Code: [ Select ]
<?php
/* Some required variables to configure this page */
 
// Variables not to be sent to you
$blocked = array('submit1');
 
// The email address the result of the form would be sent to.
$adm_email = 'your_email@your_host.com'
 
// The prefix to the mail
$mail_prefix = 'A ' . $_POST['service'] . ' request was sent to you from ' . $_POST['firstname'] . ' ' . $_POST['lastname'] . '\r\n <hr />';
 
// The post (signature) to the mail
$mail_post = null;
 
// The title for the message
$title = 'A ' . $_POST['service'] . ' request was sent to you from ' . $_POST['firstname'] . ' ' . $_POST['lastname'];
 
/* The actual code body for sending */
 
// Initiating the body var
$body = $mail_prefix;
 
// Initiating some numeric values that would be incremented in the following loop
$blocked_num = 0;
 
// Building the body for the mail
foreach($_POST as $field_name => $field_value)
{
    // Building the body for the mail with the correct fields
    if($field_name != $blocked[$blocked_num])
        $body .= "<strong>{$field_name}</strong>: {$_POST[$field_name]}<br />\r\n";
 
    // Initiating the blocked num counter if needed
    if(count($blocked) < $blocked_num)
        ++$blocked_num;
}
 
// Ending the body var
$body .= $mail_post;
 
// Trimming the ends of body from any unneeded white spaces
$body = trim($body);
 
// Requiring the SMTP class
require_once 'mail.php';
 
// Initiating the mail object
$mail = new mail();
 
// Sending the message
if(new mail($_POST['email'], $title, $body, true))
    echo 'The mail was successfully sent. Thank you for your time!';
else
    echo 'There was an error in the mailling service.';
?>
  1. <?php
  2. /* Some required variables to configure this page */
  3.  
  4. // Variables not to be sent to you
  5. $blocked = array('submit1');
  6.  
  7. // The email address the result of the form would be sent to.
  8. $adm_email = 'your_email@your_host.com'
  9.  
  10. // The prefix to the mail
  11. $mail_prefix = 'A ' . $_POST['service'] . ' request was sent to you from ' . $_POST['firstname'] . ' ' . $_POST['lastname'] . '\r\n <hr />';
  12.  
  13. // The post (signature) to the mail
  14. $mail_post = null;
  15.  
  16. // The title for the message
  17. $title = 'A ' . $_POST['service'] . ' request was sent to you from ' . $_POST['firstname'] . ' ' . $_POST['lastname'];
  18.  
  19. /* The actual code body for sending */
  20.  
  21. // Initiating the body var
  22. $body = $mail_prefix;
  23.  
  24. // Initiating some numeric values that would be incremented in the following loop
  25. $blocked_num = 0;
  26.  
  27. // Building the body for the mail
  28. foreach($_POST as $field_name => $field_value)
  29. {
  30.     // Building the body for the mail with the correct fields
  31.     if($field_name != $blocked[$blocked_num])
  32.         $body .= "<strong>{$field_name}</strong>: {$_POST[$field_name]}<br />\r\n";
  33.  
  34.     // Initiating the blocked num counter if needed
  35.     if(count($blocked) < $blocked_num)
  36.         ++$blocked_num;
  37. }
  38.  
  39. // Ending the body var
  40. $body .= $mail_post;
  41.  
  42. // Trimming the ends of body from any unneeded white spaces
  43. $body = trim($body);
  44.  
  45. // Requiring the SMTP class
  46. require_once 'mail.php';
  47.  
  48. // Initiating the mail object
  49. $mail = new mail();
  50.  
  51. // Sending the message
  52. if(new mail($_POST['email'], $title, $body, true))
  53.     echo 'The mail was successfully sent. Thank you for your time!';
  54. else
  55.     echo 'There was an error in the mailling service.';
  56. ?>

J'espère que cela avait un sens. Et I hope that helps gif "alt =": D "title =" très heureux ">


A propos de la chose PEAR. Assurez-vous que Mail.php est dans le répertoire correct et que le code a inclure l'adresse correcte à Mail.php
"Bring forth therefore fruits meet for repentance:" Matthew 3:8
  • mindfullsilence
  • Professor
  • Professor
  • Avatar de l’utilisateur
  • Inscription: Aoû 04, 2008
  • Messages: 846
  • Status: Offline

Message Juin 24th, 2009, 11:03 pm

comment puis-je configurer un compte? Désolé bogey, Im définitivement un noob quand il s'agit de php
Use your words like arrows to shoot toward your goal.
  • mindfullsilence
  • Professor
  • Professor
  • Avatar de l’utilisateur
  • Inscription: Aoû 04, 2008
  • Messages: 846
  • Status: Offline

Message Juin 24th, 2009, 11:06 pm

comment pourrais-je aller sur la fixation des "services" et le champ e-mail en tant que sujet de l'email, et mettre le reste des domaines comme le corps de l'email?
Use your words like arrows to shoot toward your goal.
  • Bogey
  • Bogey
  • Genius
  • Avatar de l’utilisateur
  • Inscription: Juil 14, 2005
  • Messages: 8211
  • Loc: USA
  • Status: Offline

Message Juin 24th, 2009, 11:07 pm

Pouvez-vous envoyer le code que vous avez reçu en sendemail.php?

Bien que ce n'est pas important. Permettez-moi d'essayer d'expliquer ce sans voir le code, mais si vous avez encore des problèmes, pouvez-vous s'il vous plaît envoyer le code ici, sauf si vous avez peur de voler des gens de votre travail.

include (Mail.php);
Tout ce qui est entre les guillemets simples "", est l'adresse du fichier que vous souhaitez inclure dans le dossier courant (sendemail.php). Est-ce l'adresse correcte?

Je mai ont rédigé quelque chose de mal, et si je les avais, Im sorry :)
"Bring forth therefore fruits meet for repentance:" Matthew 3:8
  • mindfullsilence
  • Professor
  • Professor
  • Avatar de l’utilisateur
  • Inscription: Aoû 04, 2008
  • Messages: 846
  • Status: Offline

Message Juin 24th, 2009, 11:12 pm

C'est ce qui est dans l'sendemail.php

PHP Code: [ Select ]
 
<?php
include("Mail.php");
 
$name = $_REQUEST['firsstname'] ;
$email = $_REQUEST['email'] ;
$message = $_REQUEST['textarea'] ;
$subject = $_REQUEST['service'] ;
 
/* mail setup recipients, subject etc */
$recipients = "feedback@yourdot.com";
$headers["From"] = "$email";
$headers["To"] = "email@example.com";
$headers["Subject"] = "$subject";
$mailmsg = "$subject";
/* SMTP server name, port, user/passwd */
$smtpinfo["host"] = "host.domain.com";
$smtpinfo["port"] = "25";
$smtpinfo["auth"] = true;
$smtpinfo["username"] = "username";
$smtpinfo["password"] = "password";
/* Create the mail object using the Mail::factory method */
$mail_object =& Mail::factory("smtp", $smtpinfo);
/* Ok send mail */
$mail_object->send($recipients, $headers, $mailmsg);
?>
 
  1.  
  2. <?php
  3. include("Mail.php");
  4.  
  5. $name = $_REQUEST['firsstname'] ;
  6. $email = $_REQUEST['email'] ;
  7. $message = $_REQUEST['textarea'] ;
  8. $subject = $_REQUEST['service'] ;
  9.  
  10. /* mail setup recipients, subject etc */
  11. $recipients = "feedback@yourdot.com";
  12. $headers["From"] = "$email";
  13. $headers["To"] = "email@example.com";
  14. $headers["Subject"] = "$subject";
  15. $mailmsg = "$subject";
  16. /* SMTP server name, port, user/passwd */
  17. $smtpinfo["host"] = "host.domain.com";
  18. $smtpinfo["port"] = "25";
  19. $smtpinfo["auth"] = true;
  20. $smtpinfo["username"] = "username";
  21. $smtpinfo["password"] = "password";
  22. /* Create the mail object using the Mail::factory method */
  23. $mail_object =& Mail::factory("smtp", $smtpinfo);
  24. /* Ok send mail */
  25. $mail_object->send($recipients, $headers, $mailmsg);
  26. ?>
  27.  
Use your words like arrows to shoot toward your goal.
  • Bogey
  • Bogey
  • Genius
  • Avatar de l’utilisateur
  • Inscription: Juil 14, 2005
  • Messages: 8211
  • Loc: USA
  • Status: Offline

Message Juin 24th, 2009, 11:41 pm

Où est situé votre Mail.php?

Aussi, thats firstname , NON firsstname .
"Bring forth therefore fruits meet for repentance:" Matthew 3:8
  • mindfullsilence
  • Professor
  • Professor
  • Avatar de l’utilisateur
  • Inscription: Aoû 04, 2008
  • Messages: 846
  • Status: Offline

Message Juin 24th, 2009, 11:44 pm

bin/wamp/bin/php/php5.2.9-2/PEAR/Structures/Mail.php.

Ce fichier (mail.php) a ce contenu:

Code: [ Select ]
 
<?php
//
// +----------------------------------------------------------------------+
// | PHP Version 4                                                        |
// +----------------------------------------------------------------------+
// | Copyright (c) 1997-2003 The PHP Group                                |
// +----------------------------------------------------------------------+
// | This source file is subject to version 2.02 of the PHP license,      |
// | that is bundled with this package in the file LICENSE, and is        |
// | available at through the world-wide-web at                           |
// | http://www.php.net/license/2_02.txt.                                 |
// | If you did not receive a copy of the PHP license and are unable to   |
// | obtain it through the world-wide-web, please send a note to          |
// | license@php.net so we can mail you a copy immediately.               |
// +----------------------------------------------------------------------+
// | Author: Chuck Hagenbuch <chuck@horde.org>                            |
// +----------------------------------------------------------------------+
//
// $Id: Mail.php,v 1.17 2006/09/15 03:41:18 jon Exp $
 
require_once 'PEAR.php';
 
/**
 * PEAR's Mail:: interface. Defines the interface for implementing
 * mailers under the PEAR hierarchy, and provides supporting functions
 * useful in multiple mailer backends.
 *
 * @access public
 * @version $Revision: 1.17 $
 * @package Mail
 */
class Mail
{
    /**
     * Line terminator used for separating header lines.
     * @var string
     */
    var $sep = "\r\n";
 
    /**
     * Provides an interface for generating Mail:: objects of various
     * types
     *
     * @param string $driver The kind of Mail:: object to instantiate.
     * @param array  $params The parameters to pass to the Mail:: object.
     * @return object Mail a instance of the driver class or if fails a PEAR Error
     * @access public
     */
    function &factory($driver, $params = array())
    {
        $driver = strtolower($driver);
        @include_once 'Mail/' . $driver . '.php';
        $class = 'Mail_' . $driver;
        if (class_exists($class)) {
            $mailer = new $class($params);
            return $mailer;
        } else {
            return PEAR::raiseError('Unable to find class for driver ' . $driver);
        }
    }
 
    /**
     * Implements Mail::send() function using php's built-in mail()
     * command.
     *
     * @param mixed $recipients Either a comma-seperated list of recipients
     *              (RFC822 compliant), or an array of recipients,
     *              each RFC822 valid. This may contain recipients not
     *              specified in the headers, for Bcc:, resending
     *              messages, etc.
     *
     * @param array $headers The array of headers to send with the mail, in an
     *              associative array, where the array key is the
     *              header name (ie, 'Subject'), and the array value
     *              is the header value (ie, 'test'). The header
     *              produced from those values would be 'Subject:
     *              test'.
     *
     * @param string $body The full text of the message body, including any
     *               Mime parts, etc.
     *
     * @return mixed Returns true on success, or a PEAR_Error
     *               containing a descriptive error message on
     *               failure.
     * @access public
     * @deprecated use Mail_mail::send instead
     */
    function send($recipients, $headers, $body)
    {
        $this->_sanitizeHeaders($headers);
 
        // if we're passed an array of recipients, implode it.
        if (is_array($recipients)) {
            $recipients = implode(', ', $recipients);
        }
 
        // get the Subject out of the headers array so that we can
        // pass it as a seperate argument to mail().
        $subject = '';
        if (isset($headers['Subject'])) {
            $subject = $headers['Subject'];
            unset($headers['Subject']);
        }
 
        // flatten the headers out.
        list(,$text_headers) = Mail::prepareHeaders($headers);
 
        return mail($recipients, $subject, $body, $text_headers);
 
    }
 
    /**
     * Sanitize an array of mail headers by removing any additional header
     * strings present in a legitimate header's value.  The goal of this
     * filter is to prevent mail injection attacks.
     *
     * @param array $headers The associative array of headers to sanitize.
     *
     * @access private
     */
    function _sanitizeHeaders(&$headers)
    {
        foreach ($headers as $key => $value) {
            $headers[$key] =
                preg_replace('=((<CR>|<LF>|0x0A/%0A|0x0D/%0D|\n|\r)\S).*=i',
                             null, $value);
        }
    }
 
    /**
     * Take an array of mail headers and return a string containing
     * text usable in sending a message.
     *
     * @param array $headers The array of headers to prepare, in an associative
     *              array, where the array key is the header name (ie,
     *              'Subject'), and the array value is the header
     *              value (ie, 'test'). The header produced from those
     *              values would be 'Subject: test'.
     *
     * @return mixed Returns false if it encounters a bad address,
     *               otherwise returns an array containing two
     *               elements: Any From: address found in the headers,
     *               and the plain text version of the headers.
     * @access private
     */
    function prepareHeaders($headers)
    {
        $lines = array();
        $from = null;
 
        foreach ($headers as $key => $value) {
            if (strcasecmp($key, 'From') === 0) {
                include_once 'Mail/RFC822.php';
                $parser = &new Mail_RFC822();
                $addresses = $parser->parseAddressList($value, 'localhost', false);
                if (PEAR::isError($addresses)) {
                    return $addresses;
                }
 
                $from = $addresses[0]->mailbox . '@' . $addresses[0]->host;
 
                // Reject envelope From: addresses with spaces.
                if (strstr($from, ' ')) {
                    return false;
                }
 
                $lines[] = $key . ': ' . $value;
            } elseif (strcasecmp($key, 'Received') === 0) {
                $received = array();
                if (is_array($value)) {
                    foreach ($value as $line) {
                        $received[] = $key . ': ' . $line;
                    }
                }
                else {
                    $received[] = $key . ': ' . $value;
                }
                // Put Received: headers at the top.  Spam detectors often
                // flag messages with Received: headers after the Subject:
                // as spam.
                $lines = array_merge($received, $lines);
            } else {
                // If $value is an array (i.e., a list of addresses), convert
                // it to a comma-delimited string of its elements (addresses).
                if (is_array($value)) {
                    $value = implode(', ', $value);
                }
                $lines[] = $key . ': ' . $value;
            }
        }
 
        return array($from, join($this->sep, $lines));
    }
 
    /**
     * Take a set of recipients and parse them, returning an array of
     * bare addresses (forward paths) that can be passed to sendmail
     * or an smtp server with the rcpt to: command.
     *
     * @param mixed Either a comma-seperated list of recipients
     *              (RFC822 compliant), or an array of recipients,
     *              each RFC822 valid.
     *
     * @return mixed An array of forward paths (bare addresses) or a PEAR_Error
     *               object if the address list could not be parsed.
     * @access private
     */
    function parseRecipients($recipients)
    {
        include_once 'Mail/RFC822.php';
 
        // if we're passed an array, assume addresses are valid and
        // implode them before parsing.
        if (is_array($recipients)) {
            $recipients = implode(', ', $recipients);
        }
 
        // Parse recipients, leaving out all personal info. This is
        // for smtp recipients, etc. All relevant personal information
        // should already be in the headers.
        $addresses = Mail_RFC822::parseAddressList($recipients, 'localhost', false);
 
        // If parseAddressList() returned a PEAR_Error object, just return it.
        if (PEAR::isError($addresses)) {
            return $addresses;
        }
 
        $recipients = array();
        if (is_array($addresses)) {
            foreach ($addresses as $ob) {
                $recipients[] = $ob->mailbox . '@' . $ob->host;
            }
        }
 
        return $recipients;
    }
 
}
 
  1.  
  2. <?php
  3. //
  4. // +----------------------------------------------------------------------+
  5. // | PHP Version 4                                                        |
  6. // +----------------------------------------------------------------------+
  7. // | Copyright (c) 1997-2003 The PHP Group                                |
  8. // +----------------------------------------------------------------------+
  9. // | This source file is subject to version 2.02 of the PHP license,      |
  10. // | that is bundled with this package in the file LICENSE, and is        |
  11. // | available at through the world-wide-web at                           |
  12. // | http://www.php.net/license/2_02.txt.                                 |
  13. // | If you did not receive a copy of the PHP license and are unable to   |
  14. // | obtain it through the world-wide-web, please send a note to          |
  15. // | license@php.net so we can mail you a copy immediately.               |
  16. // +----------------------------------------------------------------------+
  17. // | Author: Chuck Hagenbuch <chuck@horde.org>                            |
  18. // +----------------------------------------------------------------------+
  19. //
  20. // $Id: Mail.php,v 1.17 2006/09/15 03:41:18 jon Exp $
  21.  
  22. require_once 'PEAR.php';
  23.  
  24. /**
  25.  * PEAR's Mail:: interface. Defines the interface for implementing
  26.  * mailers under the PEAR hierarchy, and provides supporting functions
  27.  * useful in multiple mailer backends.
  28.  *
  29.  * @access public
  30.  * @version $Revision: 1.17 $
  31.  * @package Mail
  32.  */
  33. class Mail
  34. {
  35.     /**
  36.      * Line terminator used for separating header lines.
  37.      * @var string
  38.      */
  39.     var $sep = "\r\n";
  40.  
  41.     /**
  42.      * Provides an interface for generating Mail:: objects of various
  43.      * types
  44.      *
  45.      * @param string $driver The kind of Mail:: object to instantiate.
  46.      * @param array  $params The parameters to pass to the Mail:: object.
  47.      * @return object Mail a instance of the driver class or if fails a PEAR Error
  48.      * @access public
  49.      */
  50.     function &factory($driver, $params = array())
  51.     {
  52.         $driver = strtolower($driver);
  53.         @include_once 'Mail/' . $driver . '.php';
  54.         $class = 'Mail_' . $driver;
  55.         if (class_exists($class)) {
  56.             $mailer = new $class($params);
  57.             return $mailer;
  58.         } else {
  59.             return PEAR::raiseError('Unable to find class for driver ' . $driver);
  60.         }
  61.     }
  62.  
  63.     /**
  64.      * Implements Mail::send() function using php's built-in mail()
  65.      * command.
  66.      *
  67.      * @param mixed $recipients Either a comma-seperated list of recipients
  68.      *              (RFC822 compliant), or an array of recipients,
  69.      *              each RFC822 valid. This may contain recipients not
  70.      *              specified in the headers, for Bcc:, resending
  71.      *              messages, etc.
  72.      *
  73.      * @param array $headers The array of headers to send with the mail, in an
  74.      *              associative array, where the array key is the
  75.      *              header name (ie, 'Subject'), and the array value
  76.      *              is the header value (ie, 'test'). The header
  77.      *              produced from those values would be 'Subject:
  78.      *              test'.
  79.      *
  80.      * @param string $body The full text of the message body, including any
  81.      *               Mime parts, etc.
  82.      *
  83.      * @return mixed Returns true on success, or a PEAR_Error
  84.      *               containing a descriptive error message on
  85.      *               failure.
  86.      * @access public
  87.      * @deprecated use Mail_mail::send instead
  88.      */
  89.     function send($recipients, $headers, $body)
  90.     {
  91.         $this->_sanitizeHeaders($headers);
  92.  
  93.         // if we're passed an array of recipients, implode it.
  94.         if (is_array($recipients)) {
  95.             $recipients = implode(', ', $recipients);
  96.         }
  97.  
  98.         // get the Subject out of the headers array so that we can
  99.         // pass it as a seperate argument to mail().
  100.         $subject = '';
  101.         if (isset($headers['Subject'])) {
  102.             $subject = $headers['Subject'];
  103.             unset($headers['Subject']);
  104.         }
  105.  
  106.         // flatten the headers out.
  107.         list(,$text_headers) = Mail::prepareHeaders($headers);
  108.  
  109.         return mail($recipients, $subject, $body, $text_headers);
  110.  
  111.     }
  112.  
  113.     /**
  114.      * Sanitize an array of mail headers by removing any additional header
  115.      * strings present in a legitimate header's value.  The goal of this
  116.      * filter is to prevent mail injection attacks.
  117.      *
  118.      * @param array $headers The associative array of headers to sanitize.
  119.      *
  120.      * @access private
  121.      */
  122.     function _sanitizeHeaders(&$headers)
  123.     {
  124.         foreach ($headers as $key => $value) {
  125.             $headers[$key] =
  126.                 preg_replace('=((<CR>|<LF>|0x0A/%0A|0x0D/%0D|\n|\r)\S).*=i',
  127.                              null, $value);
  128.         }
  129.     }
  130.  
  131.     /**
  132.      * Take an array of mail headers and return a string containing
  133.      * text usable in sending a message.
  134.      *
  135.      * @param array $headers The array of headers to prepare, in an associative
  136.      *              array, where the array key is the header name (ie,
  137.      *              'Subject'), and the array value is the header
  138.      *              value (ie, 'test'). The header produced from those
  139.      *              values would be 'Subject: test'.
  140.      *
  141.      * @return mixed Returns false if it encounters a bad address,
  142.      *               otherwise returns an array containing two
  143.      *               elements: Any From: address found in the headers,
  144.      *               and the plain text version of the headers.
  145.      * @access private
  146.      */
  147.     function prepareHeaders($headers)
  148.     {
  149.         $lines = array();
  150.         $from = null;
  151.  
  152.         foreach ($headers as $key => $value) {
  153.             if (strcasecmp($key, 'From') === 0) {
  154.                 include_once 'Mail/RFC822.php';
  155.                 $parser = &new Mail_RFC822();
  156.                 $addresses = $parser->parseAddressList($value, 'localhost', false);
  157.                 if (PEAR::isError($addresses)) {
  158.                     return $addresses;
  159.                 }
  160.  
  161.                 $from = $addresses[0]->mailbox . '@' . $addresses[0]->host;
  162.  
  163.                 // Reject envelope From: addresses with spaces.
  164.                 if (strstr($from, ' ')) {
  165.                     return false;
  166.                 }
  167.  
  168.                 $lines[] = $key . ': ' . $value;
  169.             } elseif (strcasecmp($key, 'Received') === 0) {
  170.                 $received = array();
  171.                 if (is_array($value)) {
  172.                     foreach ($value as $line) {
  173.                         $received[] = $key . ': ' . $line;
  174.                     }
  175.                 }
  176.                 else {
  177.                     $received[] = $key . ': ' . $value;
  178.                 }
  179.                 // Put Received: headers at the top.  Spam detectors often
  180.                 // flag messages with Received: headers after the Subject:
  181.                 // as spam.
  182.                 $lines = array_merge($received, $lines);
  183.             } else {
  184.                 // If $value is an array (i.e., a list of addresses), convert
  185.                 // it to a comma-delimited string of its elements (addresses).
  186.                 if (is_array($value)) {
  187.                     $value = implode(', ', $value);
  188.                 }
  189.                 $lines[] = $key . ': ' . $value;
  190.             }
  191.         }
  192.  
  193.         return array($from, join($this->sep, $lines));
  194.     }
  195.  
  196.     /**
  197.      * Take a set of recipients and parse them, returning an array of
  198.      * bare addresses (forward paths) that can be passed to sendmail
  199.      * or an smtp server with the rcpt to: command.
  200.      *
  201.      * @param mixed Either a comma-seperated list of recipients
  202.      *              (RFC822 compliant), or an array of recipients,
  203.      *              each RFC822 valid.
  204.      *
  205.      * @return mixed An array of forward paths (bare addresses) or a PEAR_Error
  206.      *               object if the address list could not be parsed.
  207.      * @access private
  208.      */
  209.     function parseRecipients($recipients)
  210.     {
  211.         include_once 'Mail/RFC822.php';
  212.  
  213.         // if we're passed an array, assume addresses are valid and
  214.         // implode them before parsing.
  215.         if (is_array($recipients)) {
  216.             $recipients = implode(', ', $recipients);
  217.         }
  218.  
  219.         // Parse recipients, leaving out all personal info. This is
  220.         // for smtp recipients, etc. All relevant personal information
  221.         // should already be in the headers.
  222.         $addresses = Mail_RFC822::parseAddressList($recipients, 'localhost', false);
  223.  
  224.         // If parseAddressList() returned a PEAR_Error object, just return it.
  225.         if (PEAR::isError($addresses)) {
  226.             return $addresses;
  227.         }
  228.  
  229.         $recipients = array();
  230.         if (is_array($addresses)) {
  231.             foreach ($addresses as $ob) {
  232.                 $recipients[] = $ob->mailbox . '@' . $ob->host;
  233.             }
  234.         }
  235.  
  236.         return $recipients;
  237.     }
  238.  
  239. }
  240.  
Use your words like arrows to shoot toward your goal.
  • Bogey
  • Bogey
  • Genius
  • Avatar de l’utilisateur
  • Inscription: Juil 14, 2005
  • Messages: 8211
  • Loc: USA
  • Status: Offline

Message Juin 24th, 2009, 11:58 pm

Est-ce que le nom du fichier est de la capitale "M" ou minuscule "m"?

Essayer inclure ("../../ bin/php/php5.2.9-2/PEAR/Structures/Mail.php "); au lieu de include ( "Mail. php ");

Je ne sais pas si ce serait...Au cours d'idées :lol:
"Bring forth therefore fruits meet for repentance:" Matthew 3:8
  • mindfullsilence
  • Professor
  • Professor
  • Avatar de l’utilisateur
  • Inscription: Aoû 04, 2008
  • Messages: 846
  • Status: Offline

Message Juin 25th, 2009, 12:03 am

Capitol.

J'ai aussi un autre avec une minuscule situé dans le répertoire:

bin/wamp/bin/php/php5.2.9-2/PEAR/Mail/mail.php

Il contient ce code:
Code: [ Select ]
<?php
//
// +----------------------------------------------------------------------+
// | PHP Version 4                                                      |
// +----------------------------------------------------------------------+
// | Copyright (c) 1997-2003 The PHP Group                              |
// +----------------------------------------------------------------------+
// | This source file is subject to version 2.02 of the PHP license,     |
// | that is bundled with this package in the file LICENSE, and is      |
// | available at through the world-wide-web at                          |
// | http://www.php.net/license/2_02.txt.                                 |
// | If you did not receive a copy of the PHP license and are unable to |
// | obtain it through the world-wide-web, please send a note to         |
// | license@php.net so we can mail you a copy immediately.              |
// +----------------------------------------------------------------------+
// | Author: Chuck Hagenbuch <chuck@horde.org>                          |
// +----------------------------------------------------------------------+
//
// $Id: mail.php,v 1.18 2006/09/13 05:32:08 jon Exp $

/**
* internal PHP-mail() implementation of the PEAR Mail:: interface.
* @package Mail
* @version $Revision: 1.18 $
*/
class Mail_mail extends Mail {

    /**
    * Any arguments to pass to the mail() function.
    * @var string
    */
    var $_params = '';

    /**
    * Constructor.
    *
    * Instantiates a new Mail_mail:: object based on the parameters
    * passed in.
    *
    * @param array $params Extra arguments for the mail() function.
    */
    function Mail_mail($params = null)
    {
        /* The other mail implementations accept parameters as arrays.
        * In the interest of being consistent, explode an array into
        * a string of parameter arguments. */
        if (is_array($params)) {
            $this->_params = join(' ', $params);
        } else {
            $this->_params = $params;
        }

        /* Because the mail() function may pass headers as command
        * line arguments, we can't guarantee the use of the standard
        * "\r\n" separator. Instead, we use the system's native line
        * separator. */
        if (defined('PHP_EOL')) {
            $this->sep = PHP_EOL;
        } else {
            $this->sep = (strpos(PHP_OS, 'WIN') === false) ? "\n" : "\r\n";
        }
    }

    /**
    * Implements Mail_mail::send() function using php's built-in mail()
    * command.
    *
    * @param mixed $recipients Either a comma-seperated list of recipients
    *             (RFC822 compliant), or an array of recipients,
    *             each RFC822 valid. This may contain recipients not
    *             specified in the headers, for Bcc:, resending
    *             messages, etc.
    *
    * @param array $headers The array of headers to send with the mail, in an
    *             associative array, where the array key is the
    *             header name (ie, 'Subject'), and the array value
    *             is the header value (ie, 'test'). The header
    *             produced from those values would be 'Subject:
    *             test'.
    *
    * @param string $body The full text of the message body, including any
    *              Mime parts, etc.
    *
    * @return mixed Returns true on success, or a PEAR_Error
    *              containing a descriptive error message on
    *              failure.
    *
    * @access public
    */
    function send($recipients, $headers, $body)
    {
        $this->_sanitizeHeaders($headers);

        // If we're passed an array of recipients, implode it.
        if (is_array($recipients)) {
            $recipients = implode(', ', $recipients);
        }

        // Get the Subject out of the headers array so that we can
        // pass it as a seperate argument to mail().
        $subject = '';
        if (isset($headers['Subject'])) {
            $subject = $headers['Subject'];
            unset($headers['Subject']);
        }

        /*
        * Also remove the To: header. The mail() function will add its own
        * To: header based on the contents of $recipients.
        */
        unset($headers['To']);

        // Flatten the headers out.
        $headerElements = $this->prepareHeaders($headers);
        if (PEAR::isError($headerElements)) {
            return $headerElements;
        }
        list(, $text_headers) = $headerElements;

        /*
        * We only use mail()'s optional fifth parameter if the additional
        * parameters have been provided and we're not running in safe mode.
        */
        if (empty($this->_params) || ini_get('safe_mode')) {
            $result = mail($recipients, $subject, $body, $text_headers);
        } else {
            $result = mail($recipients, $subject, $body, $text_headers,
                         $this->_params);
        }

        /*
        * If the mail() function returned failure, we need to create a
        * PEAR_Error object and return it instead of the boolean result.
        */
        if ($result === false) {
            $result = PEAR::raiseError('mail() returned failure');
        }

        return $result;
    }

}
  1. <?php
  2. //
  3. // +----------------------------------------------------------------------+
  4. // | PHP Version 4                                                      |
  5. // +----------------------------------------------------------------------+
  6. // | Copyright (c) 1997-2003 The PHP Group                              |
  7. // +----------------------------------------------------------------------+
  8. // | This source file is subject to version 2.02 of the PHP license,     |
  9. // | that is bundled with this package in the file LICENSE, and is      |
  10. // | available at through the world-wide-web at                          |
  11. // | http://www.php.net/license/2_02.txt.                                 |
  12. // | If you did not receive a copy of the PHP license and are unable to |
  13. // | obtain it through the world-wide-web, please send a note to         |
  14. // | license@php.net so we can mail you a copy immediately.              |
  15. // +----------------------------------------------------------------------+
  16. // | Author: Chuck Hagenbuch <chuck@horde.org>                          |
  17. // +----------------------------------------------------------------------+
  18. //
  19. // $Id: mail.php,v 1.18 2006/09/13 05:32:08 jon Exp $
  20. /**
  21. * internal PHP-mail() implementation of the PEAR Mail:: interface.
  22. * @package Mail
  23. * @version $Revision: 1.18 $
  24. */
  25. class Mail_mail extends Mail {
  26.     /**
  27.     * Any arguments to pass to the mail() function.
  28.     * @var string
  29.     */
  30.     var $_params = '';
  31.     /**
  32.     * Constructor.
  33.     *
  34.     * Instantiates a new Mail_mail:: object based on the parameters
  35.     * passed in.
  36.     *
  37.     * @param array $params Extra arguments for the mail() function.
  38.     */
  39.     function Mail_mail($params = null)
  40.     {
  41.         /* The other mail implementations accept parameters as arrays.
  42.         * In the interest of being consistent, explode an array into
  43.         * a string of parameter arguments. */
  44.         if (is_array($params)) {
  45.             $this->_params = join(' ', $params);
  46.         } else {
  47.             $this->_params = $params;
  48.         }
  49.         /* Because the mail() function may pass headers as command
  50.         * line arguments, we can't guarantee the use of the standard
  51.         * "\r\n" separator. Instead, we use the system's native line
  52.         * separator. */
  53.         if (defined('PHP_EOL')) {
  54.             $this->sep = PHP_EOL;
  55.         } else {
  56.             $this->sep = (strpos(PHP_OS, 'WIN') === false) ? "\n" : "\r\n";
  57.         }
  58.     }
  59.     /**
  60.     * Implements Mail_mail::send() function using php's built-in mail()
  61.     * command.
  62.     *
  63.     * @param mixed $recipients Either a comma-seperated list of recipients
  64.     *             (RFC822 compliant), or an array of recipients,
  65.     *             each RFC822 valid. This may contain recipients not
  66.     *             specified in the headers, for Bcc:, resending
  67.     *             messages, etc.
  68.     *
  69.     * @param array $headers The array of headers to send with the mail, in an
  70.     *             associative array, where the array key is the
  71.     *             header name (ie, 'Subject'), and the array value
  72.     *             is the header value (ie, 'test'). The header
  73.     *             produced from those values would be 'Subject:
  74.     *             test'.
  75.     *
  76.     * @param string $body The full text of the message body, including any
  77.     *              Mime parts, etc.
  78.     *
  79.     * @return mixed Returns true on success, or a PEAR_Error
  80.     *              containing a descriptive error message on
  81.     *              failure.
  82.     *
  83.     * @access public
  84.     */
  85.     function send($recipients, $headers, $body)
  86.     {
  87.         $this->_sanitizeHeaders($headers);
  88.         // If we're passed an array of recipients, implode it.
  89.         if (is_array($recipients)) {
  90.             $recipients = implode(', ', $recipients);
  91.         }
  92.         // Get the Subject out of the headers array so that we can
  93.         // pass it as a seperate argument to mail().
  94.         $subject = '';
  95.         if (isset($headers['Subject'])) {
  96.             $subject = $headers['Subject'];
  97.             unset($headers['Subject']);
  98.         }
  99.         /*
  100.         * Also remove the To: header. The mail() function will add its own
  101.         * To: header based on the contents of $recipients.
  102.         */
  103.         unset($headers['To']);
  104.         // Flatten the headers out.
  105.         $headerElements = $this->prepareHeaders($headers);
  106.         if (PEAR::isError($headerElements)) {
  107.             return $headerElements;
  108.         }
  109.         list(, $text_headers) = $headerElements;
  110.         /*
  111.         * We only use mail()'s optional fifth parameter if the additional
  112.         * parameters have been provided and we're not running in safe mode.
  113.         */
  114.         if (empty($this->_params) || ini_get('safe_mode')) {
  115.             $result = mail($recipients, $subject, $body, $text_headers);
  116.         } else {
  117.             $result = mail($recipients, $subject, $body, $text_headers,
  118.                          $this->_params);
  119.         }
  120.         /*
  121.         * If the mail() function returned failure, we need to create a
  122.         * PEAR_Error object and return it instead of the boolean result.
  123.         */
  124.         if ($result === false) {
  125.             $result = PEAR::raiseError('mail() returned failure');
  126.         }
  127.         return $result;
  128.     }
  129. }
Use your words like arrows to shoot toward your goal.
  • Bogey
  • Bogey
  • Genius
  • Avatar de l’utilisateur
  • Inscription: Juil 14, 2005
  • Messages: 8211
  • Loc: USA
  • Status: Offline

Message Juin 25th, 2009, 12:14 am

Vous étiez en train de le faire. Vous avez été l'ouverture de la Mail_smtp.php VIA usine de Mail.php...avez-vous essayé l'adresse que je vous avais dit? Ou qui n'a pas fonctionné?
"Bring forth therefore fruits meet for repentance:" Matthew 3:8
  • mindfullsilence
  • Professor
  • Professor
  • Avatar de l’utilisateur
  • Inscription: Aoû 04, 2008
  • Messages: 846
  • Status: Offline

Message Juin 25th, 2009, 12:21 am

ce est la chose - je n'ai pas tout écrire du code. Jai tenté d'ajuster à travailler avec mon formulaire, mais sans succès. J'ai de ces fichiers, les colis, les addons, etc php - mais n'ont aucune idée de quoi faire avec eux.

La plupart sont de PEAR, je crois avoir quelques-uns de phpcodeguru.org, et un de about.com. J'ai tous ces fichiers et ne pas savoir comment les utiliser.

Je me souviens de faire un site avec un formulaire de contact et de ne pas avoir de problèmes avec elle parce que l'accueil mis en place tous les php sur le serveur, et j'ai écrit tout simplement le formulaire html et a utilisé le "post" action de pousser à Mail.php .

Cette fois, cependant, Im avoir à configurer le smtp php et n'ont aucune idée de ce fait Im. Php Ive jamais utilisé auparavant. À ce point, je ne sais pas ce que je dois mettre dans mon index.html, mon répertoire racine, ma Mail.php Mail.php ou fichiers. Im perdu :(
Use your words like arrows to shoot toward your goal.
  • mindfullsilence
  • Professor
  • Professor
  • Avatar de l’utilisateur
  • Inscription: Aoû 04, 2008
  • Messages: 846
  • Status: Offline

Message Juin 25th, 2009, 9:10 am

sendemail.php me donne encore des erreurs. J'ai changé le programme et le firsstname "" à "prénom"

Ce sont les erreurs Im obtenant:
Code: [ Select ]
Warning: include(Mail.php) [function.include]: failed to open stream: No such file or directory in C:\USR\bin\wamp\www\voltec\sendemail.php on line 2

Warning: include() [function.include]: Failed opening 'Mail.php' for inclusion (include_path='.;C:\php5\pear') in C:\USR\bin\wamp\www\voltec\sendemail.php on line 2
  1. Warning: include(Mail.php) [function.include]: failed to open stream: No such file or directory in C:\USR\bin\wamp\www\voltec\sendemail.php on line 2
  2. Warning: include() [function.include]: Failed opening 'Mail.php' for inclusion (include_path='.;C:\php5\pear') in C:\USR\bin\wamp\www\voltec\sendemail.php on line 2
Use your words like arrows to shoot toward your goal.
  • Anonymous
  • Bot
  • No Avatar
  • Inscription: 25 Feb 2008
  • Messages: ?
  • Loc: Ozzuland
  • Status: Online

Message Juin 25th, 2009, 9:10 am

Afficher de l'information

  • Total des messages de ce sujet: 40 messages
  • Utilisateurs parcourant ce forum: Aucun utilisateur enregistré et 121 invités
  • Vous ne pouvez pas poster de nouveaux sujets
  • Vous ne pouvez pas répondre aux sujets
  • Vous ne pouvez pas éditer vos messages
  • Vous ne pouvez pas supprimer vos messages
  • Vous ne pouvez pas joindre des fichiers
 
 

© 2011 Unmelted, LLC. Ozzu® est une marque déposée de Unmelted, LLC