Jump to content
php.lv forumi

Recommended Posts

Posted

Ir sekojoša mail funkcija:

 

function send_email ($to,$subject,$message2){
       $ok=false;
       $this_email_address = "info@pardodbiznesu.lv";
       $this_email_from = "Pardodbiznesu.lv";
       $mail_charset = "UTF-8";
       $this_date = date ("D, d M Y H:i:s")." +0300";
       $boundary = uniqid('vd');
       $headers = "MIME-Version: 1.0\r\nFrom: $this_email_from <$this_email_address>\r\nDate: $this_date\r\nContent-Type: multipart/alternative;boundary=".$boundary."\r\n";
       $headers2 = "-f $this_email_address";
       $message .= "\r\n\r\n--" . $boundary . "\r\n";
       $message .= "Content-type: text/html;charset=utf-8\r\n\r\n";
       $message .= $message2;
       $message .= "\r\n\r\n--" . $boundary . "--";
       if (mail("$to",$subject,$message,$headers,$headers2)) {
           $ok=true;
       }
       return $ok;
  }

 

Pārsvarā strādā ideāli, meilus arī diezgan ātri nogādā, gan uz inbox.lv, gan citur, bet ir izņēmumi.

Daži mail saņem sekjoši:

 

From: paslēpts <info@paslēpts.lv>

Date: Sat, 07 Nov 2009 20:15:36 +0300

Content-Type: multipart/alternative;boundary=vd4af5b9485db6d

Message-Id: <20091107181536.6268C3B44FB@paslēpts2.lv>
Return-Path: info@paslēpts.lv
X-OriginalArrivalTime: 07 Nov 2009 18:13:19.0070 (UTC)
FILETIME=[FBCD77E0:01CA5FD5]

--vd4af5b9485db6d

Content-type: text/html;charset=utf-8

<div style="font:12px tahoma;">..bla.bla..te teksts..</div>

 

Problēma sākas aiz MIME-Version.

Posted

Ja nav īpašas vajadzības pēc html, tad labāk tomēr sūtīt plaintext.

 

Un daudz labāk būtu, ja izmantotu kādu php meilu sūtīšanas klasi, piemēram PHPMailer. Nebūs jāčakarējas ar headeriem...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...