Page 1 of 1

HTML Email

Posted: Tue Apr 03, 2007 6:29 am
by James21
feyd | Please use

Code: Select all

,

Code: Select all

and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]


Hi, we are trying to send a HTML email to people once they fill in the form on our site, the email is sent as a HTML email but doesn’t include the style. I have tried making lines bold and a different colour both by linking it to our stylesheet and by inline style, neither had any effect and none of the div’s changed when the stylesheet was added.

I have included the code used, if anyone knows why style is not being included that would be great.

Below is the code for sending the email:

Code: Select all

if($_POST["sub"] === 'Submit your request'){
	$request = new cRequest();
	
	$request->freepickup = $_POST['freepickup'];
	$request->makemodel = $_POST['makemodel'];
	$request->year = $_POST['year'];
	$request->regno = $_POST['regno'];
	$request->tyres = $_POST['tyres'];
	$request->keys = $_POST['keys'];
	$request->documents = $_POST['documents'];
	$request->contactname = $_POST['contactname'];
	$request->telno = $_POST['telno'];
	$request->mobileno = $_POST['mobileno'];
	$request->email = $_POST['email'];
	$request->town = $_POST['town'];
	$request->postcode = $_POST['postcode'];
	$request->hash = md5($_POST['regno'].$_POST['postcode'].$_POST['makemodel'].time());

	$request->getSmarty($objSmarty);
	
	if($request->isValid($errors)){
		$request->Save($values);
		
		$objSmarty->assign("link", "http://scrapmycar/remove.php?hash=" . $request->hash);
		
		$body = $objSmarty->fetch("customeremail.tpl");
		// Email the user here
		send_mail($request->email, "jonathan@carsparefinder.com", "Vehichle Disposal request", $body);
		//
		//
		$objSmarty->assign("processed", true);
	} else {
		$objSmarty->assign("errors", $errors);
	}
}
$objSmarty->display($strTemplate);
Here is the code from the included customeremail.tpl file:

Code: Select all

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>{$page_title|default:'Salvage Car Collection'}</title>
</head>

<body>
<div id="header">
<a href="http://www.carsparefinder.co.uk"><img src="http://www.carsparefinder.co.uk/images/logo.jpg" alt="Carsparefinder.co.uk" border="0" /></a>
</div>

<p>Hi {$contactname|capitalize|escape},</p>

<p style="">Thanks for choosing our service to dispose of your {$makemodel|capitalize|escape}.</p>

<p>Once you have made arrangements for removal you will want to remove your entry from our database.</p>

<p><a href="{$link}">Please click here to do so.</a> ( {$link} )</p>

<p>Your request will be automatically removed after 7 days.</p>

<div id="footer">
<p><hr />Web Site Copyright © 2007 CarSpareFinder. All Rights Reserved.<br>
CarSpareFinder Car Parts, Unit 8 Beaumont Park, Macklin Avenue Cowpen Lane Industrial Estate, Billingham, TS23 4BY</p>
</div>
</body>
</html>

feyd | Please use

Code: Select all

,

Code: Select all

and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]

Posted: Tue Apr 03, 2007 10:20 pm
by Kieran Huggins
You have to specify the mime type of the mail - check the mail() php man page.

Better yet, give swiftmailer a look-see.

Posted: Wed Apr 04, 2007 5:56 am
by Chris Corbyn
CarSpareFinder Car Parts, Unit 8 Beaumont Park, Macklin Avenue Cowpen Lane Industrial Estate, Billingham, TS23 4BY
Awesome. I lived in Guisborough (just South of Middlesborugh) for 18 years, then in Durham for 4 years.

Posted: Wed Apr 04, 2007 5:58 am
by onion2k
I lived in Sunderland for 7 years.

Posted: Wed Apr 04, 2007 8:44 am
by Kieran Huggins
I lived in Lion's Head for 5....

Posted: Wed Apr 04, 2007 8:51 am
by feyd
ImageImage