![]() |
![]() |
![]() ![]()
Post
#1
|
|
Grupa: Zarejestrowani Postów: 33 Pomógł: 0 Dołączył: 28.10.2009 Ostrzeżenie: (0%) ![]() ![]() |
Problem polega na tym, że gdy robie wysyłanie maila bez załącznika to wszystko działa i wysyla wiadomosc normalnie, natomiast kiedy dodana jest opcja zeby ktos mogl zalacznik dodac to juz jest lipa ;/
oto kod formularza mailowego itp: To jest w pliku strony wklejone: Kod <div id="imPage"> <div id="imCel8_00"> <div id="imCel8_00_Cont"> <div id="imObj8_00"> <script type="text/javascript"><!-- function ChkFrm_8_00(oForm) { sAlert1 = "Brak wartości w polu "; sAlert2 = "Niepoprawny adres e-mail "; sAlert3 = "Nieprawidłowe pytanie kontrolne "; if (!imCheckForm(0,"Itm_8_00_1",sAlert1 + "\'Krótki opis (branża, dochód itp)\'",0,"")) return false; if (!imCheckForm(0,"Itm_8_00_3",sAlert1 + "\'załącznik\'",0,"")) return false; return (true); } //--></script> <form action="files/mail_home_8_00.php" method="post" onsubmit="return ChkFrm_8_00(this)" enctype="multipart/form-data"> <fieldset> <div class="imLineProp"> <label for="Itm_8_00_1"> Krótki opis (branża, dochód itp)*:<br /> <textarea class="imInput imInput_0" name="Itm_8_00_1" id="Itm_8_00_1" rows="8" cols="15" style="height: 120px; " onfocus="imFocus(this,'#FFFFE1')" onblur="imFocus(this,'#FFFFFF')"></textarea> </label> </div> <div class="imLineProp"> Aktualnie jesteś osobą:<br /> <label for="Itm_8_00_2_sub_1"> <input type="radio" name="Itm_8_00_2" id="Itm_8_00_2_sub_1" value="pracującą" />pracującą<br /> </label> <label for="Itm_8_00_2_sub_2"> <input type="radio" name="Itm_8_00_2" id="Itm_8_00_2_sub_2" value="bezrobotną" />bezrobotną </label> </div> <div class="imLineProp"> <label for="Itm_8_00_3"> załącznik*:<br /> <input class="imInput imInput_0" type="file" name="Itm_8_00_3" id="Itm_8_00_3" onfocus="imFocus(this,'#FFFFE1')" onblur="imFocus(this,'#FFFFFF')" /> </label> </div> <div class="imAlign_center"> <input class="imFormButton" type="submit" value=" Wyślij " /> <input class="imFormButton" type="reset" value=" Wyczyść " /> </div> </fieldset> </form> </div> </div> </div> </div> To jest plik mail_home_8_00.php Kod <?php include "../res/imemail.inc.php"; //Form Data $txtData = ""; $htmData = ""; $txtData .= "Podaj swój adres e-mail: " . $_POST["Itm_8_00_1"] . "\r\n"; $htmData .= "<tr><td width=\"25%\"><b>Podaj swój adres e-mail:</b></td><td>" . $_POST["Itm_8_00_1"] . "</td></tr>"; $csvData .= $_POST["Itm_8_00_1"] . ";"; $txtData .= "Krótki opis (branża,oczekiwane zarobki): " . $_POST["Itm_8_00_2"] . "\r\n"; $htmData .= "<tr><td width=\"25%\" bgcolor=\"#EEEEEE\"><b>Krótki opis (branża,oczekiwane zarobki):</b></td><td bgcolor=\"#EEEEEE\">" . $_POST["Itm_8_00_2"] . "</td></tr>"; $csvData .= $_POST["Itm_8_00_2"] . ";"; $txtData .= "Aktualnie jestes osobą: " . $_POST["Itm_8_00_3"] . "\r\n"; $htmData .= "<tr><td width=\"25%\"><b>Aktualnie jestes osobą:</b></td><td>" . $_POST["Itm_8_00_3"] . "</td></tr>"; $csvData .= $_POST["Itm_8_00_3"] . ";"; $txtData .= "załącznik: " . $_FILES["Itm_8_00_4"]["name"] . "\r\n"; $htmData .= "<tr><td width=\"25%\" bgcolor=\"#EEEEEE\"><b>załącznik:</b></td><td bgcolor=\"#EEEEEE\">" . $_FILES["Itm_8_00_4"]["name"] . "</td></tr>"; $csvData .= $_FILES["Itm_8_00_4"]["name"] . ";"; // 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("cv@job-less.com.pl","cv@job-less.com.pl","cv","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>"); if ($_FILES["Itm_8_00_4"]["name"] != "") $oEmail->attachFile($_FILES["Itm_8_00_4"]["name"],file_get_contents($_FILES["Itm_8_00_4"]["tmp_name"]),$_FILES["Itm_8_00_4"]["type"]); $oEmail->send(); @header("Location: ../index.html"); ?> a to jest plik imemail.inc.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; } } ?> i nie wiem co mam poradzic ;/ wywala jakis blad z nazwa pliku w pliku mail_home_8_00.php |
|
|
![]() ![]() |
![]() |
Aktualny czas: 19.08.2025 - 03:30 |