import React from 'react'; const GmailRedirectButton = () => { const redirectToGmail = () => { // Replace 'youremail@gmail.com' with the actual email address you want to open in Gmail const email = 'youremail@gmail.com'; // Replace 'Your%20Subject' with the desired subject (URL-encoded) const subject = 'Your%20Subject'; // Replace 'Your%20Body' with the desired body (URL-encoded) const body = 'Your%20Body'; // Construct the Gmail URL with the email address, subject, and body const gmailUrl = `https://mail.google.com/mail/?view=cm&fs=1&to=${email}&su=${subject}&body=${body}`; // Open Gmail in a new blank page window.open(gmailUrl, '_blank'); }; return ( <button onClick={redirectToGmail}> Redirect to Gmail </button> ); }; export default GmailRedirectButton;
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter