Ver Mensaje Individual
  #10 (permalink)  
Antiguo 24/06/2009, 03:41
una_xikilla
 
Fecha de Ingreso: agosto-2008
Mensajes: 161
Antigüedad: 18 años, 1 mes
Puntos: 0
Respuesta: Error con phpmailer y gmail

Código PHP:
<? class PHPMailer {

   var 
$Priority          = 3;

    var 
$CharSet           = 'iso-8859-1';

    var 
$ContentType        = 'text/plain';

    var 
$Encoding          = '8bit';

    var 
$ErrorInfo         = '';

    var 
$From              = 'root@localhost';

 var 
$FromName          = 'Root User';

   var 
$Sender            = '';

    var 
$Subject           = '';

    var 
$Body              = '';

    var 
$AltBody           = '';

  var 
$WordWrap          = 0;

  var 
$Mailer            = 'mail';

   var 
$Sendmail          = '/usr/sbin/sendmail';

    var 
$PluginDir         = '';

    var 
$Version           = "2.0.2";

    var 
$ConfirmReadingTo  = '';

    var 
$Hostname          = '';

    var 
$MessageID         = '';

    var 
$Host        = 'localhost';

    var 
$Port        = 25;

    var 
$Helo        = '';

    var 
$SMTPSecure = "";

    var 
$SMTPAuth     = false;

    var 
$Username     = '';

   var 
$Password     = '';

   var 
$Timeout      = 10;

   var 
$SMTPDebug    = false;

   var 
$SMTPKeepAlive = false;

   var 
$SingleTo = false;

  var 
$smtp            = NULL;
  var 
$to              = array();
  var 
$cc              = array();
  var 
$bcc             = array();
  var 
$ReplyTo         = array();
  var 
$attachment      = array();
  var 
$CustomHeader    = array();
  var 
$message_type    = '';
  var 
$boundary        = array();
  var 
$language        = array();
  var 
$error_count     = 0;
  var 
$LE              = "\n";
  var 
$sign_key_file   = "";
  var 
$sign_key_pass   = "";

   function 
IsHTML($bool) {
    if(
$bool == true) {
      
$this->ContentType = 'text/html';
    } else {
      
$this->ContentType = 'text/plain';
    }
  }

   function 
IsSMTP() {
    
$this->Mailer = 'smtp';
  }

    function 
IsMail() {
    
$this->Mailer = 'mail';
  }

   function 
IsSendmail() {
    
$this->Mailer = 'sendmail';
  }

   function 
IsQmail() {
    
$this->Sendmail = '/var/qmail/bin/sendmail';
    
$this->Mailer = 'sendmail';
  }

  function 
AddAddress($address, $name = '') {
    
$cur = count($this->to);
    
$this->to[$cur][0] = trim($address);
    
$this->to[$cur][1] = $name;
  }

   function 
AddCC($address, $name = '') {
    
$cur = count($this->cc);
    
$this->cc[$cur][0] = trim($address);
    
$this->cc[$cur][1] = $name;
  }

    function 
AddBCC($address, $name = '') {
    
$cur = count($this->bcc);
    
$this->bcc[$cur][0] = trim($address);
    
$this->bcc[$cur][1] = $name;
  }

   function 
AddReplyTo($address, $name = '') {
    
$cur = count($this->ReplyTo);
    
$this->ReplyTo[$cur][0] = trim($address);
    
$this->ReplyTo[$cur][1] = $name;
  }

  function 
Send() {
    
$header = '';
    
$body = '';
    
$result = true;

    if((
count($this->to) + count($this->cc) + count($this->bcc)) < 1) {
      
$this->SetError($this->Lang('provide_address'));
      return 
false;
    }

    
/* Set whether the message is multipart/alternative */
    
if(!empty($this->AltBody)) {
      
$this->ContentType = 'multipart/alternative';
    }

    
$this->error_count = 0; // reset errors
    
$this->SetMessageType();
    
$header .= $this->CreateHeader();
    
$body = $this->CreateBody();

    if(
$body == '') {
      return 
false;
    }

    
/* Choose the mailer */
    
switch($this->Mailer) {
      case 
'sendmail':
        
$result = $this->SendmailSend($header, $body);
        break;
      case 
'smtp':
        
$result = $this->SmtpSend($header, $body);
        break;
      case 
'mail':
        
$result = $this->MailSend($header, $body);
        break;
      default:
        
$result = $this->MailSend($header, $body);
        break;
        
//$this->SetError($this->Mailer . $this->Lang('mailer_not_supported'));
        //$result = false;
        //break;
    
}

    return 
$result;
  }