osk Posted March 2, 2010 Report Share Posted March 2, 2010 (edited) Vai kāds ir saskāries ar riga.lv pasta serveri? Es uztaisīju skriptu, kas sūta e-pastu ar pielikumu (html dokuments, kurā ir info no formas). Bet pasta serveris nerāda pielikumu, bet tikai kodētu virkni... Kāds var palīdzēt? inbox.lv nekādu problēmu nav... Edited March 2, 2010 by osk Quote Link to comment Share on other sites More sharing options...
Aleksejs Posted March 2, 2010 Report Share Posted March 2, 2010 Parādi pilnu nosūtītā epasta piemēru ar visiem headeriem. Quote Link to comment Share on other sites More sharing options...
osk Posted March 2, 2010 Author Report Share Posted March 2, 2010 Kods: $email=$fprivepasts; $to = "$name <$email>"; $from = "Bla bla bla<bla@blabla.lv>"; $subject = "pielikums"; $fileatttype = "text/html"; $fileattname = "pielikums.html"; $headers = 'Cc: bla2@blabla.lv' . "\r\n"; $headers .= "From: $from"; $data=' <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> <title>Virsraksts</title> </head> <body>Teksta blāķis HTML </body> </html> '; $semi_rand = md5( time() ); $mime_boundary = "==Multipart_Boundary_x{$semi_rand}x"; $headers .= "\nMIME-Version: 1.0\n" . "Content-Type: multipart/mixed;\n" . " boundary=\"{$mime_boundary}\""; $message = "This is a multi-part message in MIME format.\n\n" . "--{$mime_boundary}\n" . "Content-Type: text/plain; charset=\"utf-8\"\n" . "Content-Transfer-Encoding: 7bit\n\n" . "Teksts e-pasta vēstulē."."\n\n"; $message . "\n\n"; $data = chunk_split( base64_encode( $data ) ); $message .= "--{$mime_boundary}\n" . "Content-Type: {$fileatttype};\n" . " name=\"{$fileattname}\"\n" . "Content-Disposition: attachment;\n" . " filename=\"{$fileattname}\"\n" . "Content-Transfer-Encoding: base64\n\n" . $data . "\n\n" . "--{$mime_boundary}--\n"; @mail( $to, $subject, $message, $headers ); Quote Link to comment Share on other sites More sharing options...
Aleksejs Posted March 2, 2010 Report Share Posted March 2, 2010 Manuprāt tiem headeriem priekš HTMLa būt jābūt aptuveni šādiem: Content-Type: text/html; charset=utf-8 Content-Transfer-Encoding: Quoted-printable Content-Disposition: inline Vienīgi neatceros, ar ko bija garumzīmjainie burti jākodē, jo garumzīmes tekstam: Kārlis tiek pārveidotas par: K=C4=81rlis Quote Link to comment Share on other sites More sharing options...
2easy Posted March 2, 2010 Report Share Posted March 2, 2010 manuprāt, sūtot var lietot gan quoted-printable, gan base64 Quote Link to comment Share on other sites More sharing options...
osk Posted March 2, 2010 Author Report Share Posted March 2, 2010 Tas neko nedeva. Ir vēl kādi ierosinājumi? Quote Link to comment Share on other sites More sharing options...
Aleksejs Posted March 2, 2010 Report Share Posted March 2, 2010 Iespējams, ka var. Bet šajā gadījumā galvenais, kas lika to htmlu rādīt kā attachmentu, bija... Content-Disposition: attachment;\n filename=\"{$fileattname}\"\n" . Quote Link to comment Share on other sites More sharing options...
Aleksejs Posted March 2, 2010 Report Share Posted March 2, 2010 Apskaties e-pasta ziņojumam view source (lai parāda visus headerus visu metainformāciju) - tam, kas ir atnācis no Inbox un tam, ko sūti tu. Quote Link to comment Share on other sites More sharing options...
osk Posted March 2, 2010 Author Report Share Posted March 2, 2010 Izlasīju sekojošo: gmail: MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="==Multipart_Boundary_xfbbc37ac2e0b035289fb8d88973cda76x" riga.lv: MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----_=_NextPart_001_01CABA01.BD41C8BC" Quote Link to comment Share on other sites More sharing options...
briedis Posted March 2, 2010 Report Share Posted March 2, 2010 Es nečakarētos pats ar headeriem, bet labāk paņemtu un izmantotu PHPMailer klasīti :) Quote Link to comment Share on other sites More sharing options...
osk Posted March 2, 2010 Author Report Share Posted March 2, 2010 Es nečakarētos pats ar headeriem, bet labāk paņemtu un izmantotu PHPMailer klasīti :) Kas tas ir, kā to dara? Kāds labums? Quote Link to comment Share on other sites More sharing options...
Aleksejs Posted March 2, 2010 Report Share Posted March 2, 2010 Es paskatoties Gmailā kaut kādus mailus, kas man pienākuši htmliski redzu aptuveni šādu: headeri uc lietas Mime-Version: 1.0 Content-Type: multipart/alternative; boundary=mimepart_XXX --mimepart_XXX Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: Quoted-printable Content-Disposition: inline Plaintext versija --mimepart_XXX Content-Type: text/html; charset=utf-8 Content-Transfer-Encoding: Quoted-printable Content-Disposition: inline <html><body>HTML versija</body></html> --mimepart_XXX-- Quote Link to comment Share on other sites More sharing options...
briedis Posted March 2, 2010 Report Share Posted March 2, 2010 Kas tas ir, kā to dara? Kāds labums? Tāds labums, ka tev pašam nav jāčakarējas ar headeriem, to, kā pievienot failu attachmentus, daudzus saņēmējus utt. http://phpmailer.worxware.com/index.php?pg=tutorial Tev ar uzmest aci piemēriem, un turpat arī var novilkt. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.