php.de

Zurück   php.de > Webentwicklung > PHP-Fortgeschrittene

PHP-Fortgeschrittene Arbeiten mit PHP ohne Einschränkungen

Antwort
 
LinkBack Themen-Optionen Thema bewerten
Alt 20.09.2004, 10:55  
Erfahrener Benutzer
 
Registriert seit: 21.08.2003
Beiträge: 468
Spyker
Spyker eine Nachricht über ICQ schicken
Standard Mail Problem mit Anhang

Hi @ all,

Ich habe für meine Neue Version meine FormMail Klasse jetzt noch das Datein schicken mit rein gebastelt. Nun ich das meine Sendmail funktion.

PHP-Code:
function send_mail($an$von$titel$type){
$type=strtolower($type);
if(
$type != 'html' AND $type != 'text'$this->err('Falscher Mail Typ! Bitte html oder text');
        
if(
$this->mail){
    
// HTML ergänzuung Zum deaktivieren einfach auskommentieren
    
$this->mail['html'] = "<html><head>
    <style type=\"text/css\">\n
    .key {font-family: Verdana; color:black; font-size: 11px; padding-right:5px;}\n
    .data {font-family: Verdana; color:grey; font-size: 12px;}\n
    </style>\n
    </head><body>"
.$this->mail['html']."</body></html>";
    
//*/
    
    
$headers = array();
    if(
$type == 'html'){
        
$headers['mime-version'] = "MIME-Version: 1.0";
        
$headers['content-type'] = "Content-type: text/html; charset=iso-8859-1\n";
        
$headers['from'] = "From: ".$von."\n";
    }else{ 
// if else
        
$headers['mime-version'] = "MIME-Version: 1.0\n";
        
$headers['content-type'] = "Content-type: text/plain; charset=iso-8859-1\n";
        
$headers['from'] = "From: ".$von."\n";                
    } 
// if
    
    
if($this->option['file_name']){
        
        
$tempi $this->mail[$type];
        
        
$msgtmp "--FormMail\n";
        
$msgtmp .= "Content-type: text/plain; name=\"".$this->option['file_name']."\"\n";
        
$msgtmp .= "Content-transfer-encoding: base64\n\n";
        
$msgtmp .= chunk_split(base64_encode($this->getFile($this->option['file_tmp'].$this->option['file_name'])))."\n\n";
        
        
$this->mail[$type] = "--FormMail\n";
        
$this->mail[$type] .= $headers['content-type'] . "\n";
        
//$this->mail[$type] .= $msg .= "Content-Transfer-Encoding: 8bit\n\n";
        
$this->mail[$type] .= $tempi "\n\n";
        
        
$headers['content-type'] = "Content-type: multipart/mixed; boundary=\"FormMail\"";
        
        
$this->mail[$type] .= $msgtmp "\n\n";
        
$this->mail[$type] .= "--FormMail--";
    } 
// if        
    
    
$header "";
    foreach(
$headers as $value) {
        
$header .= $value "\n";
    } 
// foreach
    
    
if(!is_array($an)){
        
$arr explode(','$an);
        
$an = array();
        for(
$b 0$b sizeof($arr); $b++) // for
            
if($arr[$b] != ""array_push($antrim($arr[$b]));
    } 
// if
    
    
for($a 0$a sizeof($an); $a++){
        if(@
mail($an[$a],$titel,$this->mail[$type],$header))
            
$back true;
        else 
// if
            
$back false;
    } 
// for
    
    
return $back;
}else 
$this->err('Bitte vor send_mail noch gen_mail aufrufen!');
// function 
Nun ist das Problem das der Anhang beim Outlook-Express noch so komisch ausgegeben wird .... wenn ich das ganze aber z.B. an Outlook sende ist es ganz normal. Stimmt da irgentwas mit den headers nicht?

PS: getFile() Gibt die Datei zurück
$this->mail[$type] ist der Mail-text

MFG Tim[/code]
__________________
Typo3 Suchmaschinenoptimierung <- alles Rund um SEO mit Typo3
Spyker ist offline   Mit Zitat antworten
Sponsor Mitteilung
PHP Code Flüsterer

Registriert seit: 21.08.2005
Beiträge: 4682
PHP-Kenntnisse:
Fortgeschritten

Alt 21.09.2004, 19:38  
Gast
 
Beiträge: n/a
Standard

Hab was dazu gefunden. Wenn Du mit "komisch aussehen" das Gleiche meinst wie ich - ich habe mit untenstehendem Text mein Problem seinerzeit gelöst bekommen...

Zitat:
Re: problem with mail() & ms outlook
Quelle: http://www.zend.com/zend/spotlight/s...0&view=1#notes

...You need one blank line (two newlines "\n\n") between the email header and body as per the RFC 822.

The problem is apparently because there are two carriage returns ("\r\r\n") before and after the relevant Mime headers, which Outlook then interprets the extra "\r" as an extra blank line which puts the Mime headers into the body so the entire email get interpreted as if it has no mime headers (i.e. just text).

The problem also manifests in Eudora, if you view all the headers, you see the last character of each mime header line is doubled, e.g. "text/plain" becomes "text/plainn". This is apparently Eudora's way of saying their is an double "\r".

I verified the double "\r" by POPing an email sent with mail() using telnet and saving to a raw log file.

So what is causing the double "\r"? I have verified that I am not inputting double "\r" to mail() so and mail() is not making double "\r" for the other non-mime extra headers, such as "From:", "Reply-To:". It is making double "\r" for "Date:" also.

So my best guess is that either mail() or the SMTP server is doing it for headers it does not recognize. My guess is PHP mail() code has this bug.

I am going to try to work around the problem by only putting "\r\n" between "From:", "Reply-To:", "Cc:", and "Bcc:", and then use only "\n" between other extra headers I input to mail().

If I forget to report back here that it fixed the problem, then assume the work around did work.
  Mit Zitat antworten
Alt 21.09.2004, 21:41  
Erfahrener Benutzer
 
Registriert seit: 21.08.2003
Beiträge: 468
Spyker
Spyker eine Nachricht über ICQ schicken
Standard

werde ich mir morgen mal anschaun...
danke
__________________
Typo3 Suchmaschinenoptimierung <- alles Rund um SEO mit Typo3
Spyker ist offline   Mit Zitat antworten
Antwort


Themen-Optionen
Thema bewerten
Thema bewerten:

Forumregeln
Es ist dir nicht erlaubt, neue Themen zu verfassen.
Es ist dir nicht erlaubt, auf Beiträge zu antworten.
Es ist dir nicht erlaubt, Anhänge hochzuladen.
Es ist dir nicht erlaubt, deine Beiträge zu bearbeiten.

BB-Code ist an.
Smileys sind an.
[IMG] Code ist an.
HTML-Code ist aus.
Trackbacks are an
Pingbacks are an
Refbacks are an
Gehe zu

Ähnliche Themen
Thema Autor Forum Antworten Letzter Beitrag
Problem mit mail() Blue-Dragon PHP Tipps 2008 17 05.07.2008 22:09
Problem beim erstellen einer HTML Mail... GELight PHP Tipps 2006 15 06.10.2006 00:27
mail() Problem mit GMX Chrisber PHP Tipps 2006 4 18.04.2006 12:16
mail() problem bei <select> und <option> Marian PHP Tipps 2006 4 02.04.2006 14:07
[PHP] mail() Problem mit AOL Adressen horvath-media PHP Tipps 2006 25 23.03.2006 19:53
Problem mit mail() PHP Tipps 2006 5 08.02.2006 08:27
Problem mit der Mail Funktion. FireFIghter PHP Tipps 2006 12 02.01.2006 12:04
PHP mail() Problem PHP Tipps 2005-2 6 21.10.2005 11:07
Mail problem Marian PHP Tipps 2005-2 11 27.09.2005 18:15
Problem mit Anhang bifi5590 PHP Tipps 2005-2 3 27.07.2005 21:44
Buchstabensuppe bei mail mit Anhang PHP Tipps 2005-2 3 18.07.2005 14:31
[Erledigt] imap anhang problem PHP-Fortgeschrittene 5 14.01.2005 17:20
mail() problem Trumpfass PHP Tipps 2004-2 3 20.12.2004 20:07
Mail Problem PHP Tipps 2004-2 3 13.12.2004 22:43
Problem mit Mail PHP Tipps 2004 15 02.08.2004 22:55

Besucher kamen über folgende Suchanfragen bei Google auf diese Seite
mime header beispiel anhang, missing blank line between mime header and body, http://www.php.de/php-fortgeschrittene/9320-mail-problem-mit-anhang.html, anhang bei email funktionirt nicht, php mail anhang fehlerhaft, mailtype, outlook mail anhang type, php mail anhang fehler, typo3 email anhang, eudora encoding base64, typo3 htmlmail multipart boundary is missing, $this->htmlmail attachement typo3, php email problem attachment content, mime type email anhang, php mail mit anlage und outlook, dateianhang content-type formmailer textdatei, mail mit anhang mailtype, php mail versenden anhang part_2.dat, php mail outlook express html anhang, php mail outlook text als anhang

Alle Zeitangaben in WEZ +1. Es ist jetzt 09:50 Uhr.




Powered by vBulletin® Version 3.7.2 (Deutsch)
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.2.0
Aprilia-Forum, Aquaristik-Forum, Liebeskummer-Forum, Zierfisch-Forum, Geizkragen-Forum

Creative Commons License
Dieser Inhalt ist unter einer Creative Commons-Lizenz lizenziert.