click button to send email
Sun Dec 17 2023 20:58:41 GMT+0000 (Coordinated Universal Time)
Saved by
@eziokittu
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;
content_copyCOPY
https://chat.openai.com/c/d0b6b014-1122-44c9-9a57-b95422a27c9a
Comments