English 中文(简体)
Html Email Content using PHP
原标题:Html Email Content using PHP

I am using PHP Code to send email Here is my code

<?php

$message ="<html><head><title>Enquiry Email</title></head><body>";
$message .=  <div style="float:left"><img src="url" /></div> ;
$message .="You got a new Enquiry From Following <br/>"; 
foreach($_POST as $key =>$value){
        if(!empty($value)){
            $message.="<strong>".ucwords($key)."</strong>: ".$value."<br/>";
        }
}
$message .=  test content</body></html> ;
//echo $message; exit;
//$message=rtrim(chunk_split(base64_encode($message)));
$to      =  [email protected] ;
$subject =  New Enquiry ;
$headers =  MIME-Version: 1.0  . "
";
$headers .=  Content-Type: text/html; charset=ISO-8859-1  . "
";
//$headers . = Content-Transfer-Encoding: base64 ;
$headers .= "From: test email<[email protected]>
";

mail($to, $subject, $message, $headers);
?>

i got email in this format

Subject: New Enquiry

Content-Type: text/html; charset=ISO-8859-1

From: test email<[email protected]>

Message-Id: <[email protected]> Date: Tue, 10 Jan 2012 19:17:52 +0530 (IST) X-Brightmail-Tracker: AAAAAA== X-Brightmail-Tracker: AAAAAA==


<html><head><title>Enquiry Email</title></head><body><div style="flaot:left"><img src="linkurl" /></div>You got a new Enquiry From Following <br/><strong>Customer</strong>: Customer<br/><strong>Title</strong>: Mr.<br/><strong>Fistname</strong>: gurpreet<br/><strong>Lastname</strong>: Singh<br/><strong>Telephone</strong>: 212344556<br/><strong>Email</strong>: [email protected]<br/><strong>Address</strong>: addrewss Vi<br/><strong>Catalogue</strong>: Catalogue<br/><strong>Meeting</strong>: Meeting at my home / office<br/><strong>Internet</strong>: Internet<br/>some name </body></html>

但现在,当我试图在电子邮件服务器上发送时,它就以超文本格式提供适当的产出。

感谢!

问题回答

利用3台第三方电子邮件软件图书馆(例如Swifttranser),方便电子邮件处理。

标题应采用适当格式,删除样本代码如下:

    $headers = "From: $from";

    // boundary 
    $semi_rand = md5(time()); 
    $mime_boundary = "==Multipart_Boundary_x{$semi_rand}x";

    // headers for attachment 
    $headers .= "
MIME-Version: 1.0
"
             . "Content-Type: multipart/mixed;
"
             . " boundary="{$mime_boundary}""; 


    $message ="--{$mime_boundary}
"
             . "Content-Type: text/html; charset="iso-8859-1"
"
             . "Content-Transfer-Encoding: 7bit

" . $message . "

"; 

。 上述法典正在做罚款。 安排你的负责人。





相关问题
CSS working only in Firefox

I am trying to create a search text-field like on the Apple website. The HTML looks like this: <div class="frm-search"> <div> <input class="btn" type="image" src="http://www....

image changed but appears the same in browser

I m writing a php script to crop an image. The script overwrites the old image with the new one, but when I reload the page (which is supposed to pickup the new image) I still see the old one. ...

Firefox background image horizontal centering oddity

I am building some basic HTML code for a CMS. One of the page-related options in the CMS is "background image" and "stretch page width / height to background image width / height." so that with large ...

Separator line in ASP.NET

I d like to add a simple separator line in an aspx web form. Does anyone know how? It sounds easy enough, but still I can t manage to find how to do it.. 10x!

热门标签