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') . $path, self::STOP_CONTINUE);
}
$filename = basename($path);
if ( $name == '' ) {
$name = $filename;
}
$this->attachment[] = array(
0 => $path,
1 => $filename,
2 => $name,
3 => $encoding,
4 => $type,
5 => false, // isStringAttachment
6 => 'attachment',
7 => 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() ;
}
}
}