79302795

Date: 2024-12-23 10:28:10
Score: 0.5
Natty:
Report link
const openEmail = () => {
  const recipient = "[email protected]";
  const subject = encodeURIComponent("Subject Here");
  const body = encodeURIComponent("Body content goes here.");

  // Check if default email client exists (mailto)
  try {
    window.location.href = `mailto:${recipient}?subject=${subject}&body=${body}`;
  } catch (e) {
    // Fallback to Outlook Web App
    window.open(
      `https://outlook.office.com/mail/deeplink/compose?to=${recipient}&subject=${subject}&body=${body}`,
      '_blank'
    );
  }
};
Reasons:
  • Long answer (-0.5):
  • Has code block (-0.5):
  • Unregistered user (0.5):
  • Low reputation (1):
Posted by: jeevitha