Webmaster Forum

Go Back   Webmaster Forum > Web Development > Coding Forum

Coding Forum Problems with your code? Discuss coding issues, including JavaScript, PHP & MySQL, HTML & CSS, Flash & ActionScript, and more.


Reply
 
Thread Tools Display Modes
Share |
  #1  
Old 10-12-2016, 03:11 PM
imadam's Avatar
imadam imadam is offline
Contributing Member
 
Join Date: 12-06-09
Location: guildford
Posts: 355
iTrader: 0 / 0%
email template - best way to send a complicated html/php load of text

so i've decvided to make the quotes customers get from our website nicer. they currenlty get a basic plain text email come through listing rooms, price etc. it's fine but ugly

i've made a nice simple html template that i now want to use.


this is how i've done it before

Code:
if ($typediscount==1) { $body_priceBreakdown .= "Last Minute Discount: <b>-&pound;$discount_date</b><br />"; } if ($typediscount==2) { $body_priceBreakdown .= "Advanced Booking Discount: <b>-&pound;$discount_date</b><br />"; }
and then after the whole quote is made i put $body_priceBreakdown and $body_property etc into one variable called $body_full and do the following line

Code:
mail($your_email, "Online Quote", $body_full, "From: $your_email\r\nReply-To: $email\r\nContent-Type: text/html; charset=ISO-8859-1\r\nMIME-Version: 1.0");
this works fine before when it was just plain text, but now the email template is over 1000 lines long, with php within it. how would be the best way to store the whole template as one variable to save it as $body_full, or perhaps is there another better way i'm not thinking of?
 
Reply With Quote

Advertisement

Advertisement

  #2  
Old 10-16-2016, 11:48 PM
d4jk4 d4jk4 is offline
Junior Member
 
Join Date: 10-15-16
Posts: 7
iTrader: 0 / 0%
You want to send email with HTML view?

Search in google you can see many tutorials, just try and select good option

You should save HTML template in your database, or a file...

place your variables on this template, for example <NAME>. when you read template, just replace <NAME> with your needed value

Last edited by snakeair; 10-17-2016 at 05:52 AM.
 
Reply With Quote
  #3  
Old 10-22-2016, 02:52 PM
gxnpt's Avatar
gxnpt gxnpt is offline
Contributing Member
 
Join Date: 09-10-16
Location: far west Florida near Destin
Posts: 104
iTrader: 0 / 0%
Thumbs up snippet of code using replace

snippet from some code I have used for similar purpose using a template and replacing variables

PHP Code:
$navipane=file_get_contents('alliance.php');
$navipane=str_replace('$mebe',$mebe,$navipane); 
 
Reply With Quote
  #4  
Old 10-24-2016, 05:09 PM
imadam's Avatar
imadam imadam is offline
Contributing Member
 
Join Date: 12-06-09
Location: guildford
Posts: 355
iTrader: 0 / 0%
Quote:
Originally Posted by d4jk4 View Post
You want to send email with HTML view?

Search in google you can see many tutorials, just try and select good option

You should save HTML template in your database, or a file...

place your variables on this template, for example <NAME>. when you read template, just replace <NAME> with your needed value
ah yes good idea. makes sense thanks wil give it a go
 
Reply With Quote
Go Back   Webmaster Forum > Web Development > Coding Forum

Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Design responsive html Email Template Newsletter or Mailchimp Template at 5 USD vaishal Sell Web Services 2 07-20-2016 10:20 PM
Email Marketing - HTML or Plain Text? theChronic Marketing Forum 98 03-17-2011 12:56 PM
Mail List - SQL - Send HTML Formatted Email? Sketch Coding Forum 2 12-15-2004 09:11 PM


V7N Network
Get exposure! V7N I Love Photography V7N SEO Blog V7N Directory


All times are GMT -7. The time now is 01:21 AM.
Powered by vBulletin
Copyright 2000-2014 Jelsoft Enterprises Limited.
Copyright © 2003 - 2018 VIX-WomensForum LLC