Asked  6 Months ago    Answers:  5   Viewed   35 times

Is it possible to set the subject/content of email when I use mailto:?



Yes, look all tips and tricks with mailto:

mailto subject example:

<a href=" chocolate">example</a>

mailto with content:

<a href=" at this website&body=Hi,I found this website and thought you might like it">tell a friend</a>

As alluded to in the comments, both subject and body must be escaped properly. Use encodeURIComponent(subject) on each, rather than hand-coding for specific cases.

As Hoody mentioned in the comments, you can add line breaks by adding the following encoded sequence in the string:

%0D%0A // one line break
Tuesday, June 1, 2021
answered 6 Months ago

As you can see in RFC 6068, this is not possible at all:

The special <hfname> "body" indicates that the associated <hfvalue> is the body of the message. The "body" field value is intended to contain the content for the first text/plain body part of the message. The "body" pseudo header field is primarily intended for the generation of short text messages for automatic processing (such as "subscribe" messages for mailing lists), not for general MIME bodies.

Tuesday, June 1, 2021
answered 6 Months ago

There's a ton of answers already here, but I stumbled upon a great article about how to use Razor with email templating. Razor was pushed with ASP.NET MVC 3, but MVC is not required to use Razor. This is pretty slick processing of doing email templates

As the article identifies, "The best thing of Razor is that unlike its predecessor(webforms) it is not tied with the web environment, we can easily host it outside the web and use it as template engine for various purpose. "

Generating HTML emails with RazorEngine - Part 01 - Introduction

Leveraging Razor Templates Outside of ASP.NET: They’re Not Just for HTML Anymore!

Smarter email templates in ASP.NET with RazorEngine

Similar Stackoverflow QA

Templating using new RazorEngine API

Using Razor without MVC

Is it possible to use Razor View Engine outside

Wednesday, June 2, 2021
answered 6 Months ago

I guess the problem is your js runs before the html is loaded.

If you are using jquery, you can use the document ready function to wrap your code:

$(function() {
    var Grid = function(width, height) {
        // codes...

Or simply put your js after the <canvas>.

Thursday, July 15, 2021
answered 5 Months ago

Use %0D%0A for a line break in your body

  • How to enter line break into mailto body command (by Christian Petters; 01 Apr 2008)

Example (Demo):

<a href="">test</a>​
Wednesday, July 28, 2021
answered 4 Months ago
Only authorized users can answer the question. Please sign in first, or register a free account.
Not the answer you're looking for? Browse other questions tagged :