Recently, I have upgraded my project from Laravel 5.1 to Laravel 5.2 and I am facing a strange issue.
The emails I was sending in HTML format are not getting sent as plain text with html tags inside.
The email body and subject are configurable so I read them from database, replace the variable values and set them as a body and subject.
With Laravel 5.1 there was no issue with it. The code I am using to send email is as below:
Mail::send('layouts.email', $emailData, function($message) use ($emailData, $email_subject){
$message->to($emailData['to'], $emailData['name'])->subject($email_subject);
});
I also have tried,
Mail::send(['html' => 'layouts.email'], $emailData, function($message) use ($emailData, $email_subject){
$message->to($emailData['to'], $emailData['name'])->subject($email_subject);
});
The layout.email.blade.php template is as below:
<!DOCTYPE HTML>
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge">
</head>
<body>
{{$message_body}}
</body>
</html>
But the problem is still there. Can anybody guide me please?
Related
I'm just getting started with Dexie. I encountered an error I do not understand attempting to follow the Short Version example of Consuming Dexie as a module. I have the following source files:
index.html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Dexie Test</title>
<style>
</style>
</head>
<body>
<script src="./mytest.js" type="module"></script>
</body>
</html>
mydb.js
import Dexie from './dexie.js';
const db = new Dexie('myDb');
db.version(1).stores({
friends: 'name, age'
});
export default db;
mytest.js
import db from './mydb.js';
console.log(db.name);
When I run this from a local web server, I get the following error:
Uncaught SyntaxError: The requested module './dexie.js' does not provide an export named 'default'
To use the ES module version of Dexie you will need dexie.mjs instead of dexie.js from https://unpkg.com/dexie#^3.0.0-rc.1/dist/dexie.mjs. Or if you pick it from node_modules, make sure you've installed dexie#next or dexie#^3.0.0-rc.1.
I want send description to page and if I don't send description use default from config file
in normal php I just write
<meta name="description" content="<?= if($replaceDescrption)?$replaceDescrption:$defaultDescrption">
how can I write this in laravel blade
<meta name="description" content="#if(yield('descrption'))?#yield('descrption'):{{config('app.description')}}">
I know I can send description with
#section('description',)
<meta name="description" content="replace des">
#endsection
put I need change in tow place
<meta property="og:description" content="#if(yield('descrption'))?#yield('descrption'):{{config('app.description')}}"/>
<meta name="description" content="#if(yield('descrption'))?#yield('descrption'):config('app.description')">
#yield takes default value for 2nd argument:
<meta property="og:description" content="#yield('description', config('app.description'))"/>
I'm new to FreeMaker Template, In the below example, I want to show the <#greet person="${name}"!/> macro for 10 seconds only, then need to remove it, any idea how can I make it?
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>${title} | Kweet</title>
</head>
<body>
<#greet person="${name}"!/>
<#include "/copyright_footer.html">
</body>
</html>
<#macro greet person color="black">
<font size="+2" color="${color}">Hello ${person}!</font>
</#macro>
You can do that with JavaScript (which you put into the template). It has nothing to do FreeMarker, as that only generates the page before it's sent to the browser.
I am having trouble getting hot reloading to work with my laravel app.
//laravel homepage
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Laravel</title>
</head>
<body>
<div id="root"></div>
<?php
if (App::isLocal()):
?>
<script type="text/javascript" src="http://localhost:3000/static/bundle.js"></script>
<?php else: ?>
<script type="text/javascript" src="/dist/bundle.js"></script>
<?php endif; ?>
</body>
</html>
When I go to my homestead laravel backend page (localhost:8000), everything works fine, but there's no hot reloading when I change react components.
When I go directly to the dev-server http://localhost:3000 I get hot reloading.
I am using the react transform boilerplate: https://github.com/gaearon/react-transform-boilerplate
How can I get the backend laravel page to reload the bundle?
change
src="http://localhost:3000/static/bundle.js"
to
src="{{url('static/bundle.js)'}}"
and
src="/dist/bundle.js"
to
src="{{url('/dist/bundle.js')}}"
When I visit the site http://www.jetstar.com/au/en/home
And fill the form then submit.
It will send a POST request then redirect me to new page show the ticket price page(HTML).
I can get the expected result in the second GET response
However, When I try to repeat the POST request with Ruby or Charles
I will get 302 Found error.
I don't get it.
Ruby
q_prams = {
"ControlGroupSearchView$AvailabilitySearchInputSearchView$DropDownListFareTypes" =>"I",
"ControlGroupSearchView$AvailabilitySearchInputSearchView$DropDownListMarketDay1" =>"9",
~~~
"pageToken" =>"sLkmnwXwAsY=",
"ControlGroupSearchView$AvailabilitySearchInputSearchView$fromCS" =>"yes"
}
res = RestClient.post 'https://booknow.jetstar.com/Search.aspx', q_prams
POST request params
ControlGroupSearchView%24AvailabilitySearchInputSearchView%24DropDownListCurrency=&ControlGroupSearchView%24AvailabilitySearchInputSearchView%24DropDownListFareTypes=I&ControlGroupSearchView%24AvailabilitySearchInputSearchView%24DropDownListMarketDay1=18&ControlGroupSearchView%24AvailabilitySearchInputSearchView%24DropDownListMarketDay2=1&ControlGroupSearchView%24AvailabilitySearchInputSearchView%24DropDownListMarketDay3=&ControlGroupSearchView%24AvailabilitySearchInputSearchView%24DropDownListMarketMonth1=2015-6&ControlGroupSearchView%24AvailabilitySearchInputSearchView%24DropDownListMarketMonth2=1968-1&ControlGroupSearchView%24AvailabilitySearchInputSearchView%24DropDownListMarketMonth3=&ControlGroupSearchView%24AvailabilitySearchInputSearchView%24DropDownListPassengerType_ADT=1&ControlGroupSearchView%24AvailabilitySearchInputSearchView%24DropDownListPassengerType_CHD=0&ControlGroupSearchView%24AvailabilitySearchInputSearchView%24DropDownListPassengerType_INFANT=0&ControlGroupSearchView%24AvailabilitySearchInputSearchView%24RadioButtonMarketStructure=OneWay&ControlGroupSearchView%24AvailabilitySearchInputSearchView%24TextBoxMarketDestination1=MEL&ControlGroupSearchView%24AvailabilitySearchInputSearchView%24TextBoxMarketDestination2=&ControlGroupSearchView%24AvailabilitySearchInputSearchView%24TextBoxMarketDestination3=&ControlGroupSearchView%24AvailabilitySearchInputSearchView%24TextBoxMarketOrigin1=NAN&ControlGroupSearchView%24AvailabilitySearchInputSearchView%24TextBoxMarketOrigin2=&ControlGroupSearchView%24AvailabilitySearchInputSearchView%24TextBoxMarketOrigin3=&ControlGroupSearchView%24ButtonSubmit=&__VIEWSTATE=&culture=en-AU&date_picker=&go-booking=&pageToken=sLkmnwXwAsY%3D&ControlGroupSearchView%24AvailabilitySearchInputSearchView%24fromCS=yes&_pe_39b5379c652b_9df496572198=null&locale=en-AU
The first time response (SUCCESS) but cat not repeat it programmatically
<!doctype html><!--paulirish.com/2008/conditional-stylesheets-vs-css-hacks-answer-neither/--><!--[if lt IE 7 ]> <html lang="en" class="no-js ie6"> <![endif]--><!--[if IE 7 ]> <html lang="en" class="no-js ie7"> <![endif]--><!--[if IE 8 ]> <html lang="en" class="no-js ie8"> <![endif]--><!--[if IE 9 ]> <html lang="en" class="no-js ie9"> <![endif]--><!--[if (gt IE 9)|!(IE)]><!--><html lang="en" class="no-js"><!--<![endif]--><!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<head class="SB">
<META http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Jetstar Airways Cheap Flights, Low Fares all day everyday from the world's best Cheap Fare airline</title>
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<link rel="shortcut icon" href="favicon.ico" type="image/x-icon">
<link rel="icon" href="favicon.ico" type="image/ico">
<link rel="SHORTCUT ICON" href="favicon.ico">
...
This is most probably because of the CSRF verification, Sites users CSRF to validate the request to make sure the form submission came from the same site.
In your case, you try to submit a form from a different source and hence the verification fails.
If you want to do the above, I recon to do a screen scraping by using a library like capybara
read more about CSRF here