import { Linking } from 'react-native';

/** Open the mail app with prefilled recipient, subject and body. */
export async function composeEmail(to: string, subject: string, body: string): Promise<void> {
  const url = `mailto:${encodeURIComponent(to)}?subject=${encodeURIComponent(subject)}&body=${encodeURIComponent(body)}`;
  try {
    await Linking.openURL(url);
  } catch {
    // no mail app configured
  }
}
