sendEmail = () => {
window.open("mailto:support@example.com?subject=SendMail&body=Description");
};
return (
<div className="App">
<button
type="button"
className="btn btn-danger"
onClick={this.sendEmail}
>
Send email
</button>
</div>
);
I wrote my code in ReactJs but I am getting the blank screen. Please help.
I don't know why this doesn't work for you, I tested it and it works fine for me, but try using an anchor link instead, like this:
mailtoHref = "mailto:support@example.com?subject=SendMail&body=Description";
return (
<div className="App">
<a href={this.mailtoHref} className="btn btn-danger">
Send email
</a>
</div>
);