Sending Text and HTML Emails - Why is Gmail Always Picking Text Version? - asp.net-mvc

I'm sending some emails from my ASP.NET MVC application, using ActionMailer.NET.
Now, part of this process is sending both HTML and text versions of the message, to support text-only clients.
But what i'm seeing is that GMail is always picking the text version.
I tried Yahoo, and Yahoo is picking the HTML version correctly.
I tried dumbing down my HTML to nothing but a <h1> and a <span> tag, and GMail still picked the text version, which means there isn't a problem with the content of the HTML.
Is this expected behaviour?
Because when i send only the HTML version, GMail will show the HTML version correctly.
I've set the meta-tags in the HTML as follows:
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
Has anyone else encountered this behaviour, and found a solution?
Because as it stands, i'll probably have to send only the HTML version, so that GMail will render it, as too many of our clients use GMail.
Here's an example of basic HTML i'm trying to send:
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title></title>
</head>
<body>
<h1>This is the heading</h1>
<span>This is some text.</span>
</body>
</html>
And GMail won't even allow that.

Most web-based clients and desktop email clients ignore anything in the <head> tag of an email.
To send both html and text versions, you will need to construct the mail message properly - have two mime chunks.
Show us the full code you are using to construct your email.

I guess the first thing i should have checked is the ActionMailer.NET issues.
I did some Googling, and it didn't come up.
This issue was fixed 2 days ago, so getting the latest package fixed the problem.
https://bitbucket.org/swaj/actionmailer.net/issue/23/multipart-mail-problem
That issue was actually relating to Thunderbird, but guess GMail has a similar way of handling multipart emails.
Problem solved!

Related

pyscript error with WordPress integration

Hi Goodies i have an issue in pyscript
issue : when i paste the below pyscript code in my WordPress post as an html and press preview it just simply popups to dawnload the pyodide file instead of showing the hello world message in the code below. Please someone can clear that to me why this is happening.
thanks regards
<!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.0">
<title>Document</title>
<link rel="stylesheet" href="https://pyscript.net/latest/pyscript.css" />
<script defer src="https://pyscript.net/latest/pyscript.js"></script>
</head>
<body>
<py-script> print('Now you can!') </py-script>|
</body>
</html>
the output screenshots from the browser where i get this happening.
(1) From WordPress
this is once i write the code in real time wordpress post as an html
this is what i got once i click on preview
(2) Samething is happening in vscode live server instead of the showing the message hello world it just popup my dawnloader idm to dawnload a pyodide file.
this is the code in vscode with the live server
this is what i got once i run with the live server in vscode
i need to run a small python code in my WordPress post when someone visit my website and in that post once he requests some calculation so the python code should be responsible to do some calculations and show that to the user.
any suggestions please
From the logo on the popup messages you're getting in both cases, it looks like this is behavior caused by having [https://www.internetdownloadmanager.com/](Internet Download Manager) (IDM) installed.
When the Pyodide runtime loads, it fetches certain additional files from the web, including pyodide_py.tar (the compressed Python API files the Pyodide Python API, as well as any additional packages specified in <py-config>. If IDM is configured to interrupt fetching these necessary files, Pyodide will fail to load and/or execute.
You may be able to whitelist (allow) IDM to automatically download these files, but that's beyond my knowledge of that particular plugin.
For more discussion, here's a similar issue on the PyScript GitHub.

How can I stop iOS devices (iPad) reading telephone numbers as contact links in ASCX?

I'm working in ACSX (template for DNN), I have looked thoroughly for a fix but I have only found solutions that can work in a html document like this...
<meta name="format-detection" content="telephone=no" />
However ACSX doesn't include the tag so it doesn't allow for this solution. Is there anyway around using Javascript or even in the ASCX itself?
Just done this in the DNN settings for each page, there is a text field for all your metatags.

How to solve "500 server error" in Twitter card validater?

I am getting "500 internal server Error" from card validater Trying to validate my webpage.
I am using the following summary card in head section of my document
<meta name="twitter:card" content="$row['summary']" />
<meta name="twitter:site" content="#me" />
<meta name="twitter:title" content="$row['title']" />
<meta name="twitter:description" content="$row['description']" />
But it doesn't display summary card, I read the twitter card documentation , followed each staps and created a robot.txt file with the following contents :
User-agent:Twitterbot
Disallow :*
Allow :/webpage
But it still doesn't work. Card validater is returning the same error. My domain is on a free live server http://000webhost.com so I don't have access to the error.log life.
Can you help me solve this issue?
Is it an CMS or raw html/php? Sometime very slow host generate various error for Twitter Validator. I will suggest try using an internal link, that you could view properly, and the source shows all card meta properly. If you are using WordPress, I would have suggested using free plugin Twitter Cards Meta. It does all the coding part and direct you step by step for validation.

Why does my ios app flash on start although I have launch image [duplicate]

I have a very simple HTML5 iPhone web application that works almost perfectly; there is only one issue: between the launch image and the app homescreen, a completely white screen appears (i.e. flickers) for about one second.
I'm downloading the app to my phone from the web by using the "Add to Home Screen" button. The javascript file (functions.js) and stylesheet are both very small files.
Has anyone had this problem? Are there any ways to work around/fix it?
index.html
<!doctype html>
<html manifest="demo.manifest">
<head>
<meta charset="UTF-8">
<title>HTML5 Application</title>
<link rel="stylesheet" type="text/css" href="style.css" />
<link rel="apple-touch-icon-precomposed" href="Icon#2x.png" />
<link rel="apple-touch-startup-image" href="Default#2x.png" />
<meta name="apple-mobile-web-app-capable" content="yes" />
<meta name="viewport" content="user-scalable=no, width=device-width" />
</head>
<body>
<div id="wrapper">...</div>
</body>
<script type="text/javascript" src="function.js"></script>
</html>
demo.manifest
CACHE MANIFEST
index.html
Default#2x.png
functions.js
style.css
.htaccess
AddType text/cache-manifest .manifest
EDIT #1: I have done some more research and came upon this answer:
Clearing the screen and other artifacts while rendering is a common issue of HTML rendering due to the progressive nature of HTML. The concept is that the browser should draw as early and often as possible and render styles/scripts/content as they become available. It's possible the markup has an issue where all rendering is delayed until some content or a script is available.This could happen if:
You have dynamic heights based on image dimensions but you haven't
set the image dimensions in the markup or CSS.
Your layout is based on tables and you aren't using 'table-layout:fixed` in CSS.
Your HTML uses inline scripts with document.write().
You have some kind of onLoad() function that reveals/modifies content.
You link to an external stylesheet.
You're using uncacheable external content or you've disabled caching.
You're using external content that's returning 404 or isn't available offline.
I have followed all the suggestions in this answer, but it does not rid my web app of the white flicker. Are there any hacks to get around this issue?
EDIT #2: I have tried using no Javascript and a stylesheet with only:
body { background-color: black }
But there is still a white flicker. Since this appears to be an issue with all web applications like this, my question is: Are there any hacks to work around this issue?
CSS selectors are pretty slow on iOS (greedy CSS reset scripts have terrible performance too).
Head initiated javascript self loading DOM-ready scripts and CSS selectors running together compound the issue further. As you have both CSS and javascript requests in the head, there is a small but appreciable delay processing the body, especially the body's background colour.
Most HTML5 frameworks are moving to deferred script loading. As a minmum you want to get the stylesheet loaded first and worry about javascript second. Try putting the css at the top and scripts at the bottom, then inlining a default background colour (not image - there's an appreciable delay on iOS 5 rendering scaled background images and CSS gradients).
You can also try the async attribute on iOS5+, but I haven't tried it myself.
Hope this helps :)
Alright, seems like a basic and annoying problem. I think the best way to tackle this would be via AJAX (Asynchronous JavaScript and XML). I'm sure you probably already know what this is, but it's just a way to basically send a request from JavaScript for a file elsewhere and then load it into the page or parse it however you wish.
A little more advanced approach
For your example, I recommend you comment out the line of CSS that has the background-image like this:
.bg-container {
/* background-image: url(img/bg.png); /* commented out */
}
Note that the second comment just makes it easier to comment and uncomment the one line while debugging your code.
Now just add a simple img tag to your body, and make the src of it an ajax loader (you can find the spinning wheel generators anywhere). From here you can write some JavaScript to load the image, get rid of the spinner, and replace it.
Two simpler approaches
This solution doesn't appeal to me, I don't think most people would like it anyways. That's why I use 'Bootloader.js' which is a little AJAX loading tool I wrote a couple of months ago to help people with these sort of problems.
It's easy to use, aside from the script include, just add this meta tag:
<meta name="bootloader" content="enabled,forms('selectorOfForms'),a('selectorOfAnchors')">
The forms and anchors is optional, if you use it, it will make all your forms and links asynchronous (not for cross-domain use yet). The forms are not easy to setup, you can read the documentation on that if you would like.
Finally, set up your body like this:
<body>
<div id="body">
<!-- All the content should go here -->
</div>
<!-- This will disappear on first ajax load -->
</body>
And there you have it, this will handle everything for you.
Final suggestion
If you don't like any of these options, or want a limited yet customizable option, I recommend you use Image LazyLoader by Mika Tuupola (included with Bootloader.js) and also available at: http://www.appelsiini.net/projects/lazyload
Tell me how it goes, and what you use! XD
This problem occurs with even simple sites.
Take this for example: it shows a website with a background of #ccc with a splashscreen of #ccc for the iphone 7.
<!doctype html>
<html style="background-color: #ccc;">
<head>
<title>iOS web app</title>
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-title" content="iOS web app">
<meta name="viewport" content="initial-scale=1">
<link href="https://placehold.it/750x1294" media="(device-width: 375px) and (device-height: 667px)
and (-webkit-device-pixel-ratio: 2)" rel="apple-touch-startup-image">
</head>
<body style="background-color: #ccc;">
<h1>iOS web app</h1>
</body>
</html>
https://imgur.com/a/tGiREVM
You can see a white flicker while the app loads.
Faster loading apps feel worse, slightly epileptic, with the white flash. And if the splash screen is dark, it looks worse again.

ASP classic: String encoding

I encountered a really strange error yesterday when I refactored the start page of a old ASP classic web application.
But before I explain the problem I must explain how the website is built.
The web itself is made of ASP pages saved as ANSI windows 1252. The output sent to the browser I guess is encoded as codepage 1252, because no encoding is declared neither in the response header nor in the HTML HEAD tag.
The Problem:
When I refactored the login page (due to security issues) I did the following:
converted the ASP-file to utf-8
Added <%# Language="VBScript" #CODEPAGE=65001 %> to the top of the page
Added <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> to the HTML HEAD
The login page displayed nicely. But! The rest of the website now got encoding issues (when displayed on a web browser) on all pages (except the login page of course).
How can that be? I didnt change any other pages, and the encoding settings made in the login page should only affect that single page.
Please enlighten me. Please! :-)
Because the codepage is stored in the session and it is changing on the login page. If you clear cookies or open an incognito browser, the problem should go away until you return to the login page again.

Resources