HI WELCOME TO SIRIS

send outlook email should open using onclick on button with Javascript or using anchor tag

Leave a Comment
ry Anchor Tag Direct Open Outllook
<a href="mailto:name1@rapidtables.com?cc=name2@rapidtables.com&bcc=name3@rapidtables.com
&amp;subject=The%20subject%20of%20the%20email
&amp;body=The%20body%20of%20the%20email">
Send mail with cc, bcc, subject and body</a>

Using Javscript

<a class="email" title="Email a friend" href="#" onclick="javascript:window.location='mailto:?subject=Interesting information&body=I thought you might find this information interesting: ' + window.location;">Email</a>
<!DOCTYPE html>
<html lang="en">
    <head>
        <meta charset="utf-8">
        <title></title>
        <script>
            function SendLinkByMail(href) {
                var subject= "Interesting Information";
                var body = "I thought you might find this information interesting:\r\n\r\n<";
                body += window.location.href;
                body += ">";
                var uri = "mailto:?subject=";
                uri += encodeURIComponent(subject);
                uri += "&body=";
                uri += encodeURIComponent(body);
                window.open(uri);
            }
        </script>
    </head>
    <body>
   <p><a href="javascript:SendLinkByMail()">Email link to this page</a></p>
    </body>
</html>

If you're doing this server-side, you can just build the mailto link and emit it as the href attribute value. Then, you won't need

<button class="emailReplyButton" onClick="sendEmail(message)">Reply</button>

sendEmail(message) {
    var email = message.emailId;
    var subject = message.subject;
    var emailBody = 'Hi '+message.from;
    document.location = "mailto:"+email+"?subject="+subject+"&body="+emailBody;
}

function Setemail(mailto,cc,bcc,subjcet,body,Title)
{
 var email='<a href="mailto:'+mailto+'?cc='+mailto+'&bcc='+bcc+'&amp;subject='+subjcet'&amp;body='+body+'">'
+Title+'</a>';
}

0 comments:

Post a Comment

Note: only a member of this blog may post a comment.