Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Styling body text in a href mailto link

Tags:

html

css

I have an hyperlink which has a mailto link and I am specifying the subject and body text in the hyperlink itself. So when the user clicks on the hyperlink, his default email client application will be opened with the To, Subject and body text pre-populated in it.

I want to know how I can apply css formatting technique in the body text of it something like font names, font color etc.

Can anyone give me any idea on this?

<!DOCTYPE html>
<html>
    <head>
        <meta charset="UTF-8">
        <title>Unauthorized access</title>
        <meta content='width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no' name='viewport'>
        <!-- bootstrap 3.0.2 -->
        <link rel="stylesheet" type="text/css" href="../css/bootstrap.min.css">
        <!-- font Awesome -->
        <link href="../css/font-awesome.min.css" rel="stylesheet" type="text/css" />
        <!-- Theme style -->
    </head>
    <body class="skin-blue">
        <!-- header logo: style can be found in header.less -->
        <div>
            <!-- Right side column. Contains the navbar and content of the page -->
            <aside class="right-side" style="margin-left:0">
                <section class="content">
                    <div class="error-page" style="margin: 0">
                        <div class="error-content" style="width:100%">
                            <h3><i class="fa fa-warning text-yellow"></i> You are not authorized to view the content.</h3>       <br>
                            <p style="width:75%; text-align:center;margin-left:15%">
                                Please make sure you have the access to the server or contact support team at <a href="mailto:[email protected]?subject=Unable&nbsp;to&nbsp;access&nbsp;server&body=Hi,%0D%0A%0D%0AMy&nbsp;user&nbsp;account&nbsp;does&nbsp;not&nbsp;have&nbsp;access&nbsp;for&nbsp;the&nbsp;server.%0D%0A%0D%0ARequest&nbsp;you&nbsp;to&nbsp;kindly&nbsp;provide&nbsp;access&nbsp;to&nbsp;server.">[email protected]</a>.
                            </p>
                        </div><!-- /.error-content -->
                    </div><!-- /.error-page -->
                </section><!-- /.content -->
            </aside><!-- /.right-side -->
        </div><!-- ./wrapper -->
    </body>
</html>

On clicking the email hyperlink, the below message will be shown in the email content.

Sample

I want to apply css formatting to the content highlighted in the red box.

like image 303
Karthik Venkatraman Avatar asked Jun 14 '16 11:06

Karthik Venkatraman


People also ask

How do I add a body text to a mailto link?

subject=<subject> to the mailto tag. For example, the complete tag would look similar to the example below. You can also add body text by adding &body=body to the end of the tag, as shown in the example below. You can also include &cc= or &bcc= to fill out the CC and BCC fields.

How do I pass HTML formatted body in mailto?

It is not possible to pass the HTML in email body while using mailto link. It takes only string/text value. It says, for line breaks, instead of using <br /> use %0D%0A .

How do you add a Subject to an email link in HTML?

To create a link to send email, use <a> tag, with href attribute. The mail to link is added inside the <a> tag. To add a subject, you need to add ? and then include the subject. All this comes inside the <a> tag.


1 Answers

You can't change/modify CSS of a mail client through a <a href="mail to:[email protected]"></a> .

They have their own CSS styles and this would be a security issue

like image 88
dippas Avatar answered Sep 22 '22 14:09

dippas