Pomoc - Szukaj - Użytkownicy - Kalendarz
Pełna wersja: Problem przy wysylaniu maila z jednym pliczkiem na home.pl
Forum PHP.pl > Forum > PHP
bubolski
Oto ten pliczek kod pliku :
Kod
<?php
include "../res/imemail.inc.php";

//Form Data
$txtData = "";
$htmData = "";
$txtData .= "xxx: " . $_POST["Itm_8_00_1"] . "\r\n";
$htmData .= "<tr><td width=\"25%\"><b>Imie:</b></td><td>" . $_POST["Itm_8_00_1"] . "</td></tr>";
$csvData .= $_POST["Itm_8_00_1"] . ";";
$txtData .= "xxx: " . $_POST["Itm_8_00_2"] . "\r\n";
$htmData .= "<tr><td width=\"25%\" bgcolor=\"#EEEEEE\"><b>xxx:</b></td><td bgcolor=\"#EEEEEE\">" . $_POST["Itm_8_00_2"] . "</td></tr>";
$csvData .= $_POST["Itm_8_00_2"] . ";";
$txtData .= "xxx: " . $_POST["Itm_8_00_3"] . "\r\n";
$htmData .= "<tr><td width=\"25%\"><b>xxx:</b></td><td>" . $_POST["Itm_8_00_3"] . "</td></tr>";
$csvData .= $_POST["Itm_8_00_3"] . ";";
$txtData .= "xxx: " . $_POST["Itm_8_00_4"] . "\r\n";
$htmData .= "<tr><td width=\"25%\" bgcolor=\"#EEEEEE\"><b>xxx:</b></td><td bgcolor=\"#EEEEEE\">" . $_POST["Itm_8_00_4"] . "</td></tr>";
$csvData .= $_POST["Itm_8_00_4"] . ";";
$txtData .= "xxx: " . $_POST["Itm_8_00_5"] . "\r\n";
$htmData .= "<tr><td width=\"25%\"><b>xxx:</b></td><td>" . $_POST["Itm_8_00_5"] . "</td></tr>";
$csvData .= $_POST["Itm_8_00_5"] . ";";
$txtData .= "xxx: " . $_POST["Itm_8_00_6"] . "\r\n";
$htmData .= "<tr><td width=\"25%\" bgcolor=\"#EEEEEE\"><b>xxx:</b></td><td bgcolor=\"#EEEEEE\">" . $_POST["Itm_8_00_6"] . "</td></tr>";
$csvData .= $_POST["Itm_8_00_6"] . ";";
$txtData .= "xxx: " . $_POST["Itm_8_00_7"] . "\r\n";
$htmData .= "<tr><td width=\"25%\"><b>xxx:</b></td><td>" . $_POST["Itm_8_00_7"] . "</td></tr>";
$csvData .= $_POST["Itm_8_00_7"] . ";";
$txtData .= "xxx: " . $_POST["Itm_8_00_8"] . "\r\n";
$htmData .= "<tr><td width=\"25%\" bgcolor=\"#EEEEEE\"><b>xxx:</b></td><td bgcolor=\"#EEEEEE\">" . $_POST["Itm_8_00_8"] . "</td></tr>";
$csvData .= $_POST["Itm_8_00_8"] . ";";
$txtData .= "Kod pocztowy: " . $_POST["Itm_8_00_9"] . "\r\n";
$htmData .= "<tr><td width=\"25%\"><b>Kod pocztowy:</b></td><td>" . $_POST["Itm_8_00_9"] . "</td></tr>";
$csvData .= $_POST["Itm_8_00_9"] . ";";
$txtData .= "xxx: " . $_POST["Itm_8_00_10"] . "\r\n";
$htmData .= "<tr><td width=\"25%\" bgcolor=\"#EEEEEE\"><b>xxx:</b></td><td bgcolor=\"#EEEEEE\">" . $_POST["Itm_8_00_10"] . "</td></tr>";
$csvData .= $_POST["Itm_8_00_10"] . ";";
$txtData .= "xxx: " . $_POST["Itm_8_00_11"] . "\r\n";
$htmData .= "<tr><td width=\"25%\"><b>xxx:</b></td><td>" . $_POST["Itm_8_00_11"] . "</td></tr>";
$csvData .= $_POST["Itm_8_00_11"] . ";";
$txtData .= "xxx: " . $_POST["Itm_8_00_12"] . "\r\n";
$htmData .= "<tr><td width=\"25%\" bgcolor=\"#EEEEEE\"><b>xxx:</b></td><td bgcolor=\"#EEEEEE\">" . $_POST["Itm_8_00_12"] . "</td></tr>";
$csvData .= $_POST["Itm_8_00_12"] . ";";

// Template
$htmHead = "<table width=\"90%\" border=\"0\" bgcolor=\"#FFFFFF\" cellpadding=\"4\" style=\"font: 11px Tahoma; color: #000000; border: 1px solid #BBBBBB;\">";
$htmFoot = "</table>";

//Send email to owner
$txtMsg = "";
$htmMsg = $htmHead . "<tr><td></td></tr>" . $htmFoot;
$oEmail = new imEMail("adres@xx.pl",adres e mail","xxxz","windows-1250");
$oEmail->setText($txtMsg . "\r\n\r\n" . $txtData);
$oEmail->setHTML("<html><body bgcolor=\"#063A69\"><center>" . $htmMsg . "<br>" . $htmHead . $htmData . $htmFoot . "<br>" . $htmHead . "<tr><td style=\"font-size: 85%\">" . $csvData . "</td></tr>" . $htmFoot . "</center></body></html>");
$oEmail->send();

@header("Location: ../xxx.html");
?>



Która funkcja moze nie byc nie obslugiwana na home.pl , poniewaz na az.pl dziala mi all elegancko , lecz niestety jest to lipny hosting i chce sie dowiedziec jaka to funkcja, zeby home.pl mi ja aktywowal i zebym mogl tam przezucic moja strone
fander
No ja też mam problem, wiesz, nie podałeś żadnych konkretnych informacji (błędy przy wysyłaniu tylko jakiś kod który nic nie wnosi), a fusy do wróżenia z mojej porannej kawy już mi się skończyły...
bubolski
problem polega na autoryzacji serwera. Dzwonilem do home.pl powiedzieli mi zeby dodac adres serwera smtp, port i autoryzacje , jednak nie wiem jak. Jestem poczatkujacy i stronke stworzylem w programie website x 5 evolution. Jest tam mozliwosc stworzenia formularzu e-mail. Na stronie zamieszczonej na az.pl wszystko ladnie chodzi, a na home.pl juz nie. Wypelnia sie formularz, po czym klika sie wyslij. Powinno w tej chwili nastapic wyslanie maila i przejscie na inna strone , oto kod pliku immail.inc.php. Poniewaz na home.pl wypelnia sie formularz klika wyslij i przechodzi na biala strone , w adresie jest podany adres pliku www.xxx.pl/mail_p001_8_00.php

Jego tresc podana jest wyzej , a tu podam tresc pliku immail.inc.php poniewaz jest on includowany do pliku mail_p001_8_00.php
Kod
<?php
  //Incomedia WebSite X5 EMail Class. All rights reserved.

    //true = force the user email address to be set as the sender
  $imForceSender = false;
  
    class imEMail {
        var $from;
        var $to;
        var $subject;
        var $charset;
        var $text;
        var $html;
        
        var $attachments;
        
        function imEMail($from,$to,$subject,$charset) {
            $this->from = $from;
            $this->to = $to;
            $this->subject = $subject;
            $this->charset = $charset;
        }
        
        function setFrom($from) {
            $this->from = $from;
        }
        
        function setTo($to) {
            $this->to = $to;
        }
        
        function setSubject($subject) {
            $this->subject = $subject;
        }
        
        function setCharset($charset) {
            $this->charset = $charset;
        }
        
        function setText($text) {
            $this->text = $text;
        }
        
        function setHTML($html) {
            $this->html = $html;
        }
        
        function attachFile($name,$content,$mime_type) {
            $attachment['name'] = $name;
            $attachment['content'] = base64_encode($content);
            $attachment['mime_type'] = $mime_type;
            $this->attachments[] = $attachment;
        }
        
        function send() {
            $headers = "";
            $msg = "";

            if($this->from == "" || $this->to == "" || ($this->text == "" && $this->html == ""))
                return false;
            
            $boundary = md5(time());
            
            $headers .= "From: " . $this->from . "\r\n";
            $headers .= "Message-ID: <" . time() . rand(0,9) . rand(0,9) . "@websitex5.users>\r\n";
            $headers .= "X-Mailer: WebSiteX5 Mailer\r\n";
            $headers .= "MIME-Version: 1.0\r\n";

            if(is_array($this->attachments)) {
                $headers .= "Content-Type: multipart/mixed; boundary=\"" . $boundary . "\"\r\n\r\n";
                $headers .= "--" . $boundary . "\r\n";
            }
            
            if($this->html == "") {
                $headers .= "Content-Type: text/plain; charset=" . $this->charset . "\r\n";
                $headers .= "Content-Transfer-Encoding: 8bit\r\n";
                $msg .= $this->text . "\r\n\r\n";
            }
            else if($this->text == "") {
                $headers .= "Content-Type: text/html; charset=" . $this->charset . "\r\n";
                $headers .= "Content-Transfer-Encoding: 8bit\r\n";
                $msg .= $this->html . "\r\n\r\n";
            }
            else {
                $alt_boundary = $boundary . "_alt";
                $headers .= "Content-Type: multipart/alternative; boundary=\"" . $alt_boundary . "\"\r\n";
                
                $msg .= "--" . $alt_boundary . "\r\n";
                $msg .= "Content-Type: text/plain; charset=" . $this->charset . "\r\n";
                $msg .= "Content-Transfer-Encoding: 7bit\r\n\r\n";
                $msg .= $this->text . "\r\n\r\n";
                
                $msg .= "--" . $alt_boundary . "\r\n";
              $msg .= "Content-Type: text/html; charset=" . $this->charset . "\r\n";
                $msg .= "Content-Transfer-Encoding: 7bit\r\n\r\n";
                $msg .= $this->html . "\r\n\r\n";
                
                $msg .= "--" . $alt_boundary . "--\r\n\r\n";
            }
            
            if(is_array($this->attachments)) {
                foreach($this->attachments as $attachment) {
                    $msg .= "--" . $boundary . "\r\n";
                    $msg .= "Content-Type: " . $attachment["mime_type"] . "; name=\"" . $attachment["name"] . "\"\r\n";
                    $msg .= "Content-Transfer-Encoding: base64\r\n";
                    $msg .= "Content-Disposition: attachment; filename=\"" . $attachment["name"] . "\"\r\n\r\n";
                    $msg .= chunk_split($attachment["content"]) . "\r\n\r\n";
                }
            
                $msg .= "--" . $boundary . "--\r\n\r\n";
            }
            
            $r = @mail($this->to, $this->subject, $msg, $headers, "-f" . $this->from);
            if(!$r) {
                $headers = "To: " . $this->to . "\r\n" . $headers;
                $r = @mail($this->to, $this->subject, $msg, $headers);
            }
            return $r;
        }
    }
?>



W ktorym z tych plikow, gdzie dokladnie i jak dodac autoryzacje serwera smtp , jego nazwe i port? Jezeli opis problemu nie jest wystarczajacy i podane pliki tez to napiszcie co podac to dam
fander
A w czym polega problem? maile nie docierają czy skrypt się wywala ?
bubolski
juz dziala wszystko , wystarczylo dodac do skryptu na gorze

require("class.phpmailer.php");
$mail = new PHPMailer();
$mail->IsSMTP(); // telling the class to use SMTP
$mail->Host = "xxxx.domenal"; // SMTP server
$mail->From = "adres@domena";
$mail->AddAddress("adres@domenal");
fander
dobrze, a widzisz że teraz używasz phpMailera a kod przez ciebie podany ni jak go nie przypomina o_O w skrypcie podanym przez ciebie użyłeś imEMail

Coś tutaj nie gra...
To jest wersja lo-fi głównej zawartości. Aby zobaczyć pełną wersję z większą zawartością, obrazkami i formatowaniem proszę kliknij tutaj.
Invision Power Board © 2001-2025 Invision Power Services, Inc.