I'm using Apache/2.4.4 (Unix) PHP/5.5.3 OpenSSL/1.0.1e mod_perl/2.0.8-dev Perl/v5.16.3, and i get an Error 500 when i try opening this page in my browser
/xamppfiles/htdocs/wm/frontend/www/ Below if my error log.
[Tue Mar 18 17:03:51.923726 2014] [core:alert] [pid 933] [client ::1:51765] /Applications/XAMPP/xamppfiles/htdocs/wm/frontend/www/.htaccess: FilterProvider takes three arguments, filter-name provider-name match-expression
here is my htaccess file
# ----------------------------------------------------------------------
# Gzip compression
# ----------------------------------------------------------------------
<IfModule mod_deflate.c>
# Force deflate for mangled headers developer.yahoo.com/blogs/ydn/posts/2010/12/pushing-beyond-gzipping/
<IfModule mod_setenvif.c>
<IfModule mod_headers.c>
SetEnvIfNoCase ^(Accept-EncodXng|X-cept-Encoding|X{15}|~{15}|-{15})$ ^((gzip|deflate)\s*,?\s*)+|[X~-]{4,13}$ HAVE_Accept-Encoding
RequestHeader append Accept-Encoding "gzip,deflate" env=HAVE_Accept-Encoding
</IfModule>
</IfModule>
# HTML, TXT, CSS, JavaScript, JSON, XML, HTC:
<IfModule filter_module>
FilterDeclare COMPRESS
FilterProvider COMPRESS DEFLATE resp=Content-Type $text/html
FilterProvider COMPRESS DEFLATE resp=Content-Type $text/css
FilterProvider COMPRESS DEFLATE resp=Content-Type $text/plain
FilterProvider COMPRESS DEFLATE resp=Content-Type $text/xml
FilterProvider COMPRESS DEFLATE resp=Content-Type $text/x-component
FilterProvider COMPRESS DEFLATE resp=Content-Type $application/javascript
FilterProvider COMPRESS DEFLATE resp=Content-Type $application/json
FilterProvider COMPRESS DEFLATE resp=Content-Type $application/xml
FilterProvider COMPRESS DEFLATE resp=Content-Type $application/xhtml+xml
FilterProvider COMPRESS DEFLATE resp=Content-Type $application/rss+xml
FilterProvider COMPRESS DEFLATE resp=Content-Type $application/atom+xml
FilterProvider COMPRESS DEFLATE resp=Content-Type $application/vnd.ms-fontobject
FilterProvider COMPRESS DEFLATE resp=Content-Type $image/svg+xml
FilterProvider COMPRESS DEFLATE resp=Content-Type $application/x-font-ttf
FilterProvider COMPRESS DEFLATE resp=Content-Type $font/opentype
FilterChain COMPRESS
FilterProtocol COMPRESS DEFLATE change=yes;byteranges=no
</IfModule>
<IfModule !mod_filter.c>
# Legacy versions of Apache
AddOutputFilterByType DEFLATE text/html text/plain text/css application/json
AddOutputFilterByType DEFLATE application/javascript
AddOutputFilterByType DEFLATE text/xml application/xml text/x-component
AddOutputFilterByType DEFLATE application/xhtml+xml application/rss+xml application/atom+xml
AddOutputFilterByType DEFLATE image/svg+xml application/vnd.ms-fontobject application/x-font-ttf font/opentype
</IfModule>
</IfModule>
i tried this, but no luck either
<IfVersion >= 2.4.4>
<IfModule filter_module>
FilterDeclare COMPRESS
FilterProvider COMPRESS DEFLATE resp=Content-Type $text/html
FilterProvider COMPRESS DEFLATE resp=Content-Type $text/css
FilterProvider COMPRESS DEFLATE resp=Content-Type $text/plain
FilterProvider COMPRESS DEFLATE resp=Content-Type $text/xml
FilterProvider COMPRESS DEFLATE resp=Content-Type $text/x-component
FilterProvider COMPRESS DEFLATE resp=Content-Type $application/javascript
FilterProvider COMPRESS DEFLATE resp=Content-Type $application/json
FilterProvider COMPRESS DEFLATE resp=Content-Type $application/xml
FilterProvider COMPRESS DEFLATE resp=Content-Type $application/xhtml+xml
FilterProvider COMPRESS DEFLATE resp=Content-Type $application/rss+xml
FilterProvider COMPRESS DEFLATE resp=Content-Type $application/atom+xml
FilterProvider COMPRESS DEFLATE resp=Content-Type $application/vnd.ms-fontobject
FilterProvider COMPRESS DEFLATE resp=Content-Type $image/svg+xml
FilterProvider COMPRESS DEFLATE resp=Content-Type $application/x-font-ttf
FilterProvider COMPRESS DEFLATE resp=Content-Type $font/opentype
FilterChain COMPRESS
FilterProtocol COMPRESS DEFLATE change=yes;byteranges=no
</IfModule>
</IfVersion>
<IfVersion <= 2.4.4>
<IfModule filter_module>
FilterDeclare COMPRESS
FilterProvider COMPRESS DEFLATE "%{Content_Type} = 'text/html'"
FilterProvider COMPRESS DEFLATE "%{Content_Type} = 'text/css'"
FilterProvider COMPRESS DEFLATE "%{Content_Type} = 'text/plain'"
FilterProvider COMPRESS DEFLATE "%{Content_Type} = 'text/xml'"
FilterProvider COMPRESS DEFLATE "%{Content_Type} = 'text/x-component'"
FilterProvider COMPRESS DEFLATE "%{Content_Type} = 'application/javascript'"
FilterProvider COMPRESS DEFLATE "%{Content_Type} = 'application/json'"
FilterProvider COMPRESS DEFLATE "%{Content_Type} = 'application/xml'"
FilterProvider COMPRESS DEFLATE "%{Content_Type} = 'application/xhtml+xml'"
FilterProvider COMPRESS DEFLATE "%{Content_Type} = 'application/rss+xml'"
FilterProvider COMPRESS DEFLATE "%{Content_Type} = 'application/atom+xml'"
FilterProvider COMPRESS DEFLATE "%{Content_Type} = 'application/vnd.ms-fontobject'"
FilterProvider COMPRESS DEFLATE "%{Content_Type} = 'image/svg+xml'"
FilterProvider COMPRESS DEFLATE "%{Content_Type} = 'image/x-icon'"
FilterProvider COMPRESS DEFLATE "%{Content_Type} = 'application/x-font-ttf'"
FilterProvider COMPRESS DEFLATE "%{Content_Type} = 'font/opentype'"
FilterChain COMPRESS
FilterProtocol COMPRESS DEFLATE change=yes;byteranges=no
</IfModule>
</IfVersion>
Your logic is flawed. You have the %{Content_Type} syntax being used for the older version, and both IfVersion conditionals will match version 2.4.4 because you have "or equal to" on both conditionals.
This should work:
<IfVersion < 2.4.4>
<IfModule filter_module>
FilterDeclare COMPRESS
FilterProvider COMPRESS DEFLATE resp=Content-Type $text/html
FilterProvider COMPRESS DEFLATE resp=Content-Type $text/css
FilterProvider COMPRESS DEFLATE resp=Content-Type $text/plain
FilterProvider COMPRESS DEFLATE resp=Content-Type $text/xml
FilterProvider COMPRESS DEFLATE resp=Content-Type $text/x-component
FilterProvider COMPRESS DEFLATE resp=Content-Type $application/javascript
FilterProvider COMPRESS DEFLATE resp=Content-Type $application/json
FilterProvider COMPRESS DEFLATE resp=Content-Type $application/xml
FilterProvider COMPRESS DEFLATE resp=Content-Type $application/xhtml+xml
FilterProvider COMPRESS DEFLATE resp=Content-Type $application/rss+xml
FilterProvider COMPRESS DEFLATE resp=Content-Type $application/atom+xml
FilterProvider COMPRESS DEFLATE resp=Content-Type $application/vnd.ms-fontobject
FilterProvider COMPRESS DEFLATE resp=Content-Type $image/svg+xml
FilterProvider COMPRESS DEFLATE resp=Content-Type $application/x-font-ttf
FilterProvider COMPRESS DEFLATE resp=Content-Type $font/opentype
FilterChain COMPRESS
FilterProtocol COMPRESS DEFLATE change=yes;byteranges=no
</IfModule>
</IfVersion>
<IfVersion >= 2.4.4>
<IfModule filter_module>
FilterDeclare COMPRESS
FilterProvider COMPRESS DEFLATE "%{Content_Type} = 'text/html'"
FilterProvider COMPRESS DEFLATE "%{Content_Type} = 'text/css'"
FilterProvider COMPRESS DEFLATE "%{Content_Type} = 'text/plain'"
FilterProvider COMPRESS DEFLATE "%{Content_Type} = 'text/xml'"
FilterProvider COMPRESS DEFLATE "%{Content_Type} = 'text/x-component'"
FilterProvider COMPRESS DEFLATE "%{Content_Type} = 'application/javascript'"
FilterProvider COMPRESS DEFLATE "%{Content_Type} = 'application/json'"
FilterProvider COMPRESS DEFLATE "%{Content_Type} = 'application/xml'"
FilterProvider COMPRESS DEFLATE "%{Content_Type} = 'application/xhtml+xml'"
FilterProvider COMPRESS DEFLATE "%{Content_Type} = 'application/rss+xml'"
FilterProvider COMPRESS DEFLATE "%{Content_Type} = 'application/atom+xml'"
FilterProvider COMPRESS DEFLATE "%{Content_Type} = 'application/vnd.ms-fontobject'"
FilterProvider COMPRESS DEFLATE "%{Content_Type} = 'image/svg+xml'"
FilterProvider COMPRESS DEFLATE "%{Content_Type} = 'image/x-icon'"
FilterProvider COMPRESS DEFLATE "%{Content_Type} = 'application/x-font-ttf'"
FilterProvider COMPRESS DEFLATE "%{Content_Type} = 'font/opentype'"
FilterChain COMPRESS
FilterProtocol COMPRESS DEFLATE change=yes;byteranges=no
</IfModule>
</IfVersion>
Related
If I don't explain this issue properly, please say and I'll edit it to suit.
I have a program called 'LiveAgent' which relies heavily on SQL insertion and retrieval - which was working untl my server upgraded the PHP from 7.0 to 7.2, and the SQL from 10.1 to 10.2.17_MariaDB. I've been told the .htaccess needs changing so the software can communicate with the server. I'm very confused. The software shows all entries until the 22nd, when the server was upgraded (UK2). Since then you can't submit anything into it.
The htaccess file is below. As is the code for adding an 'appointment'.
HTACCESS
# Mod Rewrite
Options +FollowSymLinks
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
RewriteCond %{HTTPS} !on
RewriteCond %{REQUEST_URI} !^/[0-9]+\..+\.cpaneldcv$
RewriteCond %{REQUEST_URI} !^/\.well-known/pki-validation/[A-F0-9]{32}\.txt(?:\ Comodo\ DCV)?$
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI}
#Fix Rewrite
Options -Multiviews
#http://forum.codecall.net/topic/74170-clean-urls-with-php/
<IfModule mod_deflate.c>
# Compress HTML, CSS, JavaScript, Text, XML and fonts
AddOutputFilterByType DEFLATE application/javascript
AddOutputFilterByType DEFLATE application/rss+xml
AddOutputFilterByType DEFLATE application/vnd.ms-fontobject
AddOutputFilterByType DEFLATE application/x-font
AddOutputFilterByType DEFLATE application/x-font-opentype
AddOutputFilterByType DEFLATE application/x-font-otf
AddOutputFilterByType DEFLATE application/x-font-truetype
AddOutputFilterByType DEFLATE application/x-font-ttf
AddOutputFilterByType DEFLATE application/x-javascript
AddOutputFilterByType DEFLATE application/xhtml+xml
AddOutputFilterByType DEFLATE application/xml
AddOutputFilterByType DEFLATE font/opentype
AddOutputFilterByType DEFLATE font/otf
AddOutputFilterByType DEFLATE font/ttf
AddOutputFilterByType DEFLATE image/svg+xml
AddOutputFilterByType DEFLATE image/x-icon
AddOutputFilterByType DEFLATE text/css
AddOutputFilterByType DEFLATE text/html
AddOutputFilterByType DEFLATE text/javascript
AddOutputFilterByType DEFLATE text/plain
AddOutputFilterByType DEFLATE text/xml
# Remove browser bugs (only needed for really old browsers)
BrowserMatch ^Mozilla/4 gzip-only-text/html
BrowserMatch ^Mozilla/4\.0[678] no-gzip
BrowserMatch \bMSIE !no-gzip !gzip-only-text/html
Header append Vary User-Agent
</IfModule>
## EXPIRES CACHING ##
<IfModule mod_expires.c>
ExpiresActive On
ExpiresByType image/jpg "access plus 1 year"
ExpiresByType image/jpeg "access plus 1 year"
ExpiresByType image/gif "access plus 1 year"
ExpiresByType image/png "access plus 1 year"
ExpiresByType text/css "access plus 1 month"
ExpiresByType application/pdf "access plus 1 month"
ExpiresByType text/x-javascript "access plus 1 month"
ExpiresByType application/x-shockwave-flash "access plus 1 month"
ExpiresByType image/x-icon "access plus 1 year"
ExpiresDefault "access plus 2 days"
</IfModule>
## EXPIRES CACHING
# php -- BEGIN cPanel-generated handler, do not edit
# Set the “ea-php70” package as the default “PHP” programming language.
<IfModule mime_module>
AddType application/x-httpd-ea-php70 .php .php7 .phtml
</IfModule>
# php -- END cPanel-generated handler, do not edit
AJAX:
if($ajax['1'] == 'add_new_appointment'){
include 'files/add_new_appointment.php';
}
ADD NEW APPOINTMENT
<form action="" method="post" class="form-horizontal" >
<div class="modal-body">
<?php // ------------- ERROR -----------------
foreach ($notification_msg as &$notification) { ?>
<div class="alert <?php echo $notification['type'] ?>"><button type="button" class="close" data-dismiss="alert">×</button><strong><?php echo $notification['h4'] ?> </strong> <?php echo $notification['msg'] ?></div>
<?php } // ------------- ERROR ----------------- ?>
<input type="hidden" name="session_id" value="<?php echo $ajax['0'] ?>">
<input type="hidden" name="create_appointment" value="true">
<div class="form-group">
<label class="col-sm-3 control-label">Find Customer *</label>
<div class="col-sm-9">
<select name="customer" id="customer-single" style="width:100%" required>
<option value="">Select a customer</option>
<?php foreach(customer_array($ajax['0']) as $customer){ ?>
<option value="<?php echo $customer['id'] ?>"><?php echo $customer['business_name'] ?> - <?php echo $customer['first_name'] ?> <?php echo $customer['last_name'] ?></option>
<?php } ?>
</select>
If your customer is not listed you can add them here.
</div>
</div>
<hr>
<div class="form-group">
<label class="col-sm-2 control-label">Category *</label>
<div class="col-sm-10">
<select name="category" id="category-single" style="width:100%" required>
<option value="">Select a category</option>
<?php foreach(category_array($ajax['0']) as $category){ ?>
<option value="<?php echo $category['id'] ?>"><?php echo $category['name'] ?></option>
<?php } ?>
</select>
</div>
</div>
<div class="form-group">
<label class="col-sm-2 control-label">Date *</label>
<div class="col-sm-4">
<input class="form-control datepicker" type="text" name="date" required>
</div>
<div class="col-sm-1">
<label class="control-label">Time *</label>
</div>
<div class="col-sm-2">
<input class="form-control timepicker" type="text" name="start_time" required>
</div>
<div class="col-sm-1">
<label class="control-label">To *</label>
</div>
<div class="col-sm-2">
<input class="form-control timepicker" type="text" name="end_time" required>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">Booked By *</label>
<div class="col-sm-9">
<select name="booked_by" id="agent-single" style="width:100%" required>
<?php foreach (agent_array($ajax['0']) as $agent){ ?>
<option <?php if($agent['id'] == get_agent_from_session($ajax['0'], 'id')){echo 'selected';} ?> value="<?php echo $agent['id'] ?>"><?php echo $agent['first_name'] ?></option>
<?php } ?>
</select>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">Booked for *</label>
<div class="col-sm-9">
<select name="booked_for[]" id="agent-multi" multiple="multiple" style="width:100%" required>
<?php foreach (agent_array($ajax['0']) as $agent){ ?>
<option value="<?php echo $agent['id'] ?>"><?php echo $agent['first_name'] ?></option>
<?php } ?>
</select>
</div>
</div>
<div class="form-group">
<label class="col-sm-2 control-label">Notes</label>
<div class="col-sm-10">
<textarea class="form-control" name="notes"> </textarea>
</div>
</div>
</div>
<div class="modal-footer">
Close
<button type="submit" class="btn btn-success">Save</button>
</div>
</form>
DATABASE CONNECTION
// arrays
$notification_msg = array();
$bank_holidays = array();
// connect to db
try {
$dbh = new PDO("mysql:host=$dbhostname;dbname=db", $dbusername, $dbpassword);
/*** echo a message saying we have connected ***/
//$notification_msg[] = array(type=>'alert-success', h4=>'Success', msg=>'Connected to database');
}
catch(PDOException $e)
{
$notification_msg[] = array(type=>'alert-success', h4=>'', msg=>$e->getMessage());
}
PHP/SQL Code:
if($_POST['create_appointment']){
$customer_id = htmlspecialchars($_POST['customer'], ENT_QUOTES);
$category_id = htmlspecialchars($_POST['category'], ENT_QUOTES);
$date = htmlspecialchars($_POST['date'], ENT_QUOTES);
$start_time = htmlspecialchars($_POST['start_time'], ENT_QUOTES);
$end_time = htmlspecialchars($_POST['end_time'], ENT_QUOTES);
$booked_by = htmlspecialchars($_POST['booked_by'], ENT_QUOTES);
$booked_for = post_array_to_explode($_POST['booked_for']);
$notes = htmlspecialchars($_POST['notes'], ENT_QUOTES);
$session_id = htmlspecialchars($_POST['session_id'], ENT_QUOTES);
$time = date("Y-m-d H:i:s");
$agent_id = get_agent_from_session($session_id, 'id');
$start_date = $date.' '.$start_time;
$end_date = $date.' '.$end_time;
$start_date = format_datetime_mysql($start_date);
$end_date = format_datetime_mysql($end_date);
$insert = $dbh->exec("INSERT INTO calendar(start_date, end_date, notes, category_id, customer_id, added_by, booked_by, booked_for, date_added) VALUES ('$start_date', '$end_date', '$notes', '$category_id', '$customer_id', '$agent_id', '$booked_by', '$booked_for', '$time')");
if($insert){
$notification_msg[] = array(type=>'alert-success', h4=>'Success!', msg=>'Appointment Created');
push_browser_notify('New appointment booked', format_date($start_date).' - '.get_customer_json('business_name', $customer_id).' ('.get_customer_json('first_name', $customer_id).' '.get_customer_json('last_name', $customer_id).') ', '');
header('Location: ' . $_SERVER['HTTP_REFERER']);
}else{
$notification_msg[] = array(type=>'alert-warning', h4=>'Warning!', msg=>'Appointment NOT Created');
}
}
.htaccess
# Remove .php extension
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}.php -f
RewriteRule ^(.*?)/?$ $1.php [L]
# Return 404 if original request is .php
RewriteCond %{THE_REQUEST} "^[^ ]* .*?\.php[? ].*$"
RewriteRule .* - [L,R=404]
This works fine, but how to modify the code so that a language switch based on this code works?
Currently it does the following:
localhost/index = OK
localhost/index.php = OK (404 error)
but when you press the button
EN
it will change the address as follows
localhost/index => localhost/index.php?la=en = FAIL (404 page)
which throws 404 error as well. Is it possible to prevent it? Would it just prevent the .php from being added before the query string? I want the language switch to work as well, is it possible? Any ideas?
Language switch:
<?php
session_start();
if($_GET['la']){
$_SESSION['la'] = $_GET['la'];
header('Location:'.$_SERVER['PHP_SELF']);
exit();
}
switch($_SESSION['la']){
case "eng":
require('lang/eng.php');
break;
case "fre":
require('lang/fre.php');
break;
case "ger":
require('lang/ger.php');
break;
default:
require('lang/eng.php');
}
?>
<!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><?php echo $lang['index-title'];?></title>
<link href="style/style.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="wrapper">
<div id="langSelect">
<img src="flags/eng.png" alt="<?=$lang['lang-eng'];?>" title="<?=$lang['lang-eng'];?>" />
<img src="flags/fra.png" alt="<?=$lang['lang-fre'];?>" title="<?=$lang['lang-fre'];?>" />
<img src="flags/ger.png" alt="<?=$lang['lang-ger'];?>" title="<?=$lang['lang-ger'];?>" />
</div>
<div id="cont">
<p><?=$lang['index-welcome'];?></p>
<p><?=$lang['index-text-1'];?></p>
</div>
</div>
</body>
</html>
SOLVED!
Replace:
header('Location:'.$_SERVER['PHP_SELF']);
With:
header('Location:'. str_replace(".php", "", $_SERVER['PHP_SELF']));
The problem is at : header('Location:'.$_SERVER['PHP_SELF']);
The $_SERVER["PHP_SELF"] is a super global variable that returns the
filename of the currently executing script.
Change it to:
header('Location:'. str_replace(".php", "", $_SERVER['PHP_SELF']));
which remove the extension from the string.
Hope it helps.
I have an email template that contains a var - ${token} for a temporary password. In this case, token == #.iJ<ep2C]a-d$}4xK{. When rendered in Gmail token is truncated at the < character and rendered as #.iJ. How can I escape chars in token so they render correctly in Gmail?
Template
From: info#mycompany.com
Subject: New User Activation
MIME-Version: 1.0
Content-Type: multipart/alternative; boundary="alternative_boundary"
This is a message with multiple parts in MIME format.
--alternative_boundary
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: 8bit
Dear ${firstName} ${lastName},
Please click on the below link and use Temporary password: ${token} to activate your new account.
${reset_url}
--alternative_boundary
Content-Type: text/html; charset="utf-8"
Content-Transfer-Encoding: 8bit
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
<title>New account activation</title>
</head>
<body>
<p>Dear ${firstName} ${lastName},</p>
<p>Please click here to activate your new account and use verification code: ${token} in the page</p>
</body>
</html>
You'll want to escape the reserved characters per the MDN docs:
& &
< <
> >
" "
Gmail thinks the < is the start of an HTML tag.
Assuming you're using JavaScript replace these in the token like Fastest method to escape HTML tags as HTML entities?:
function escapeHtmlEntities(str) {
return str
.replace(/&/g, '&')
.replace(/</g, '<')
.replace(/>/g, '>')
.replace(/"/g, '"');
}
In your template:
...${escapeHtmlEntities(token)}...
So we have a php page www.example.com with a button which redirects to www.subdomain.example.com
We are facing following issues with sub domain and htaccess:
When we use button the
media queries and favicons do not work
When we user button where the sub domain code is, the URL masking doesn't work (but media queries and favicons work perfectly)
We have HTACCESS configured such that .php is hidden in URL and www.example.com/folder/index2 is masked by www.subdomain.example.com
Throughout the sub domain title also doesn't work
We have following setup in GoDaddy:
subdomain -> www.subdomain
www.subdomain -> www.example.com/folder/index2
example.com -> www.example.com
The sub domain code is in example.com/folder/
We are trying to understand how the mapping works as code is working perfectly fine without sub domain but messes up when we redirect the URL.
Main index file
<html>
<head>
<?php
$dir = "favicons/";
$files = array();
if ($handle = opendir($dir))
{
while (false !== ($file = readdir($handle)))
{
$files[] = $file;
}
}
$icon = $files[rand(2,count($files)-1)];
echo '<LINK REL="shortcut icon" HREF="favicons/'.$icon.'">';
?>
<meta charset="utf-8">
<title>Title</title>
<meta content="width=device-width, initial-scale=1" name="viewport">
<link href="assets/css/main2.css" rel="stylesheet">
</head>
<body>
<div class="center">
<img href=""src="images/bg.jpg">
<br>
<br>
<button class="bt">button</button>
</div>
<script src="assets/js/jquery.min.js">
</script>
<script src="assets/js/jquery.poptrox.min.js">
</script>
<script src="assets/js/skel.min.js">
</script>
<script src="assets/js/main.js">
</script>
</body>
</html>
Index2 file which is in the folder pointed by subdomain
<!DOCTYPE html>
<html>
<head>
<?php
$dir = "../favicons/";
$files = array();
if ($handle = opendir($dir))
{
while (false !== ($file = readdir($handle)))
{
$files[] = $file;
}
}
$icon = $files[rand(2,count($files)-1)];
echo '<LINK REL="shortcut icon" HREF="../favicons/'.$icon.'">';
?>
<meta charset="utf-8">
<title>Title</title>
<meta content="width=device-width, initial-scale=1" name="viewport">
<link href="../assets/css/main1.css" rel="stylesheet">
<link href="https://fonts.googleapis.com/css?family=Raleway" rel="stylesheet">
</head>
<body>
<h1>random text</h1>
<br>
<script src="assets/js/jquery.min.js">
</script>
<script src="../assets/js/jquery.poptrox.min.js">
</script>
<script src="../assets/js/skel.min.js">
</script>
<script src="../assets/js/main.js">
</script>
</body>
</html>
HTACCESS file
# Turn mod_rewrite on
RewriteEngine On
RewriteBase /
# To externally redirect /dir/foo.php to /dir/foo/
RewriteCond %{THE_REQUEST} ^[A-Z]{3,}\s([^.]+)\.php [NC]
RewriteRule ^ %1 [R,L,NC]
## To internally redirect /dir/foo/ to /dir/foo.php
RewriteCond %{REQUEST_FILENAME}.php -f [NC]
RewriteRule ^ %{REQUEST_URI}.php [L]
ErrorDocument 400 www.example.com/Error-404
ErrorDocument 401 www.example.com/Error-404
ErrorDocument 403 www.example.com/Error-404
ErrorDocument 404 www.example.com/Error-404
ErrorDocument 500 www.example.com/Error-404
I have tried all I can think of string-to-byte-array-transformer, no string-to-byte-array-transformer, and I still get the email sent in plain/text format.
Here is my gmail version when I show original message:
Subject: Why no markup?
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Return-Path: rufus#abc.com
<html><head><meta http-equiv="Content-Type" content="text/html" charset="us-ascii"/></head><body><p>An HTML paragraph</p></body></html>
Please shine a light on what I am doing wrong.
Thanks, Don
Below is a simple test case:
<mule xmlns:scripting="http://www.mulesoft.org/schema/mule/scripting" xmlns:smtp="http://www.mulesoft.org/schema/mule/smtp" xmlns:quartz="http://www.mulesoft.org/schema/mule/quartz"
xmlns="http://www.mulesoft.org/schema/mule/core" xmlns:doc="http://www.mulesoft.org/schema/mule/documentation" xmlns:spring="http://www.springframework.org/schema/beans"
version="EE-3.5.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="
http://www.mulesoft.org/schema/mule/scripting http://www.mulesoft.org/schema/mule/scripting/current/mule-scripting.xsd http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-current.xsd
http://www.mulesoft.org/schema/mule/core http://www.mulesoft.org/schema/mule/core/current/mule.xsd
http://www.mulesoft.org/schema/mule/smtp http://www.mulesoft.org/schema/mule/smtp/current/mule-smtp.xsd
http://www.mulesoft.org/schema/mule/quartz http://www.mulesoft.org/schema/mule/quartz/current/mule-quartz.xsd">
<flow name="htmlemailtestFlow1" doc:name="htmlemailtestFlow1">
<quartz:inbound-endpoint jobName="Q1" repeatInterval="60000" responseTimeout="10000" doc:name="Quartz">
<quartz:event-generator-job />
</quartz:inbound-endpoint>
<scripting:component doc:name="Groovy">
<scripting:script engine="Groovy">
<scripting:text><![CDATA[return '<html><head><meta http-equiv="Content-Type" content="text/html" charset="us-ascii"/></head><body><p>An HTML paragraph</p></body></html>']]></scripting:text>
</scripting:script>
</scripting:component>
<string-to-byte-array-transformer mimeType="text/html" doc:name="String to Byte Array" />
<smtp:outbound-endpoint host="mail.abc.com" to="dharrington#abc.com" from="rufus#abc.com" subject="Why no markup?"
responseTimeout="10000" doc:name="AsnEmail" mimeType="text/html" />
</flow>
</mule>
Do you have to set the contentType on the connector:
<smtp:connector name="smtp"
validateConnections="true" contentType="text/html" />
As described in the previous comment, graphically, it is enough to make the configuration of the image if you can not apply it by code