Can I set subject/content of email using mailto:?
Yes, look all tips and tricks with mailto: http://www.angelfire.com/dc/html-webmaster/mailto.htm
mailto subject example:
<a href="mailto:no-one@snai1mai1.com?subject=free chocolate">example</a>
HTML mailto subject with '&'
You need to URL-encode the text; so it becomes:
<a href="mailto:no-one@snai1mai1.com?subject=free chocolate %26 cake&Body=get free hurry.">example
</a>
%26
is the Url-encoded representation of &
mailto: subject= and body= support in email clients
The behavior varies by both email client and source application. Here's a likely enough example from my own system, using pjp's link.
<a href="mailto:me@somewhere.com?subject=Hello%20People">Send Mail</a>
- Mailto link followed within Outlook client successfully fills subject
- Mailto link followed in IE successfully fills subject for Outlook client
- Mailto link followed in Firefox fails for same Outlook client (subject text remains part of "TO" field)
I tried the same link in HTML emails read by gmail and Yahoo web clients.
- Gmail correctly opens a new message with desired subject
- Yahoo pre-fills the subject, but truncates at the space ("Hello" only)
That much variation on just one computer makes embedded mailto tricky to use. I bet that's why many email newsletters provide a "View as a web page" link in the header.
Can you pre-fill parts of an email using mailto?
How do you add a signature to a mailto without PHP (or equivalent)?
While your answer was sort of vague, you could try something like this, where you write something at the top and have a few carriage returns (%0D
) followed by the signature Mailed from yoursite.com
. %20
can be used to ensure that the browser displays spaces correctly.
<a href="mailto:someone@example.com?subject=Hello%20there&body=Body%20stuff%20goes%20here.%0D%0DMailed%20from%20yoursite.com">Send Mail</a>
You can take a look at this w3 schools link or this discussion (as mentioned by Obsidian Age).
mailto link with HTML body
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.
Mailto with Subject and Body in Blazor
Everything in the mailto: has to be Url encoded. Especially the URL from navigationManager.
This works:
<a href="mailto:?subject=MessageCode%3A @ErrorCode Test&body=Test%20Test,%0D%0A%0D%0AURL%3A @MyUrl">Send Mail</a>
with
string MyUrl => System.Web.HttpUtility.UrlEncode(navigationManager.Uri);
Also note the %3A instead of :
When your @ErrorCode can have punctuation in it then give it the same treatment.
It is a good thing that space are allowed because %20@ErrorCode does not work.
Related Topics
Why Can't I Do ≪Img Src="C:/Localfile.Jpg"≫
How to Target a Specific Column or Row in CSS Grid Layout
Scraping Data from Website Using Vba
Svgs Not Scaling Properly in Ie - Has Extra Space
Input/Button Elements Not Shrinking in a Flex Container
Angular 2 Dropdown Options Default Value
Why Do Browsers Still Inject ≪Tbody≫ in Html5
Generate an HTML Response in a Java Servlet
Set the Table Column Width Constant Regardless of the Amount of Text in Its Cells
Some Emmet Abbreviations in Vsc Not Working, Like '!' or Using '*'
Html5 Best Practices; Section/Header/Aside/Article Elements
Is There a Limit to the Length of HTML Attributes
Percent Pie Chart With CSS Only
Why Doesn't Table ≫ Tr ≫ Td Work When Using the Child Selector