Reputation: 51
sendEmail = () => {
window.open("mailto:[email protected]?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.
Upvotes: 1
Views: 7079
Reputation: 683
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:[email protected]?subject=SendMail&body=Description";
return (
<div className="App">
<a href={this.mailtoHref} className="btn btn-danger">
Send email
</a>
</div>
);
Upvotes: 1