Page 1 of 1

html format on email response form

Posted: Tue Jul 26, 2005 10:30 am
by samohtwerdna
Hello all,

I have a simple request for information form on my web site Contact

I would like to do more than simple html tags to format the email response, like maybe use some CSS for some containers.

Here is the format portion of my php script:

Code: Select all

//**********************************************************/	
	/* START EMAIL FORMAT */
	if(!$error) {
		$msg .= "\n\n<h4>THE KITCHEN STRAND CONTACT FORM</h4>\n";
		$msg .= "\n\n<p><i>This is the information filled out by:</i></p><br />\n";
		
		$msg .= $name . "\n";		
		$msg .= "\n\n-<br />\n";
		$msg .= "\n\n------------------------<br />\n";
			
		$msg .= "Address:<br /> " . $addr1 . "\n";
		$msg .= "\n\n<br />\n";
		$msg .= $city . " " . $state . " " . $zip . "\n";
		$msg .= "\n\n------------------------<br />\n";
		$msg .= "Phone:<br /> " . $phone . "\n";
		$msg .= "\n\n<br />\n";
		$msg .= "\n\n<h5>--- Comments: ---</h5>\n";
		
		if($comments != '') {
			$msg .= $comments . "\n";
			}
		$msg .= "\n\n<br />\n";
		$msg .= "\n\n------------------------<br />\n";
		$msg .= "\n\n<h5>--- RETURN ADDRESS: ---</h5>\n";
		
		if($email != '') {	 
			$msg .= $email . "\n";
			}
		$msg .= "\n\n<br />\n";	
		$msg .= "\n\n------------------------<br />\n";

		$subject .= "Kitchen Strand Contact Us Form";
		$to .= "fred@kitchenstrand.us";				/*change value to as many accounts as desired just add a comma, space and keep accounts with in one set of " "*/
		$headers .= "From: ". $name . " <$email>\r\n"; 
		$headers .= "Reply-To: ". $name . " <$email>\r\n"; 
		$headers .= "X-Priority: 0\r\n"; 
		$headers .= "Content-Type: text/html; charset=iso-8859-1\n"; // Mime type
		$headers .= "bcc:andy@wmohs.com, dadcock658@aol.com\n"; // BCCs to
		mail($to,$subject,$msg,$headers);
		$sent = true;
		
//**********************************************************/		
		
		/* END EMAIL FORMAT */

//**********************************************************/
		
		}
	}
Any suggestions??

Thanks

Posted: Tue Jul 26, 2005 11:05 am
by anjanesh
I think including MIME version is compulsory.

Code: Select all

$headers  = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html;

Posted: Tue Jul 26, 2005 11:28 am
by samohtwerdna
ok so the MIME version allows me to format the mail with CSS?

If so how do I insert the CSS, and can I use <div> tags to organize my content?

Like:

Code: Select all

//**********************************************************/ 

/* START EMAIL FORMAT */

if(!$error) {

$msg .= "\n\n<h4>THE KITCHEN STRAND CONTACT FORM</h4>\n";

$msg .= "\n\n<div id="main"><p><i>This is the information filled out by:</i></p><br />\n";

/*ect*/
$msg .= $name . "\n"; 

$msg .= "\n\n<br />\n"; 

$msg .= "\n\n------------------------<br /></div>\n";

/*ect*/

$headers .= 'MIME-Version: 1.0' . "\r\n"; 

$headers .= "Content-Type: text/html; charset=iso-8859-1\n"; // Mime type


mail($to,$subject,$msg,$headers);

$sent = true;


//**********************************************************/ 


/* END EMAIL FORMAT */

//**********************************************************/


}

}

Posted: Tue Jul 26, 2005 11:55 am
by anjanesh
samohtwerdna wrote: ok so the MIME version allows me to format the mail with CSS?
I had pondered over this a long ago only to find out that most email readers dont parse CSS - just HTML tags.