Einzelnen Beitrag anzeigen
  #4 (permalink)  
Alt 18-07-2016, 10:24
jensgebken
 Registrierter Benutzer
Links : Onlinestatus : jensgebken ist offline
Registriert seit: Nov 2004
Beiträge: 34
jensgebken ist zur Zeit noch ein unbeschriebenes Blatt
Standard

das ist der passus in der class.phpmailer.php
PHP-Code:
  public function AddAttachment($path$name ''$encoding 'base64'$type 'application/octet-stream') {
    try {
      if ( !@
is_file($path) ) {
        throw new 
phpmailerException($this->Lang('file_access') . $pathself::STOP_CONTINUE);
      }
      
$filename basename($path);
      if ( 
$name == '' ) {
        
$name $filename;
      }

      
$this->attachment[] = array(
        
=> $path,
        
=> $filename,
        
=> $name,
        
=> $encoding,
        
=> $type,
        
=> false,  // isStringAttachment
        
=> 'attachment',
        
=> 0
      
);

    } catch (
phpmailerException $e) {
      
$this->SetError($e->getMessage());
      if (
$this->exceptions) {
        throw 
$e;
      }
      echo 
$e->getMessage()."\n";
      if ( 
$e->getCode() == self::STOP_CRITICAL ) {
        return 
false;
      }
    }
    return 
true;
  }

  
/**
  * Return the current array of attachments
  * @return array
  */
  
public function GetAttachments() {
    return 
$this->attachment;
  } 
und das ist der term in der helpers.php (wordpress)

PHP-Code:
        $fromEmail $settings->SMTP_EMAIL;
        
$fromName $settings->SMTP_NAME;

        if (
$settings->email_mode == '4') {
            
$headers 'From: '.$fromName.' <'.$settings->SMTP_EMAIL.'>' "\r\n";
            
$headers .= 'Content-Type: text/html; charset="UTF-8" \r\n';
            
$stat wp_mail($email$sub$msg$headers);
            return (
$stat) ? 'sent' 'Error with wp mail';
        } else {
            if (!
class_exists('PHPMailer')) require_once dirname__FILE__ ) . '/class.phpmailer.php';

            try {
                
$mail = new PHPMailer(true);

                if (
$settings->email_mode == '1') {
                    
$mail->IsMail();
                } else {
                    
$mail->IsSMTP();
                }
                
$mail->SMTPAuth   true;

                if (
$settings->emailSSL != "false"$mail->SMTPSecure $settings->emailSSL;

                
$mail->Port $settings->SMTP_PORT;
                
$mail->Host $settings->SMTP_HOST;
                
$mail->Username $settings->SMTP_EMAIL;
                
$mail->Password $settings->SMTP_PASS;


                
$mail->AddReplyTo($fromEmail$fromName);
                
$mail->From $fromEmail;
                
$mail->FromName $fromName;

                
$mail->AddAddress($email);
                
$mail->Subject $sub;

                
$mail->AltBody "To view the message, please use an HTML compatible email viewer!";
                
$mail->AddAttachment("/www/htdocs/w00fcb5e/meinedomain.de/test.pdf"); // attachment geändert
                
$mail->MsgHTML($msg);
                
$mail->IsHTML(true);
                
// $mail->CharSet = 'UTF-8';

                 
if (!$mail->Send()){
                    return 
$mail->ErrorInfo;
                 }

                 return  
"sent";
            } catch (
phpmailerException $e) {
                return  
"Exception Error: ".$e->errorMessage() ;
            }
        }

     } 
Mit Zitat antworten