Share via Email subject using text properly

Using Ionic React v7 with Capacitor v5, I am attempting to use @capacitor/share to share content via email. According to the docs and TypeScript typedocs on the share method, the title parameter should be treated as the subject if sharing via email.

I am instead experiencing the Share.share method is ignoring the title parameter, instead using the text parameter for both the email subject AND email content/

import { shareOutline } from 'ionicons/icons';

import { Share } from '@capacitor/share';
import { IonButton, IonIcon } from '@ionic/react';

export const SocialShare: React.FC<SocialShareProps> = ({}) => {
  const onShare = () => {
    return Share.share({
      title: 'This is the title', // expected subject, actually ignored
      text: 'Share text content here', // expected email content, actually email content AND email subject
      url: '',
  return (
    <IonButton className='m-0 text-base' fill='clear' color='primary' mode='ios' onClick={onShare}>
      <IonIcon slot='icon-only' src={shareOutline} md={shareOutline} />

results in

Same. Shares to iOS default mail app ok. But GMail seems to be doing what you describe above.

That sounds like a bug/issue with Gmail itself. The Capacitor plugin is setting EXTRA_SUBJECT on the Intent here.

if (title != null) {
    intent.putExtra(Intent.EXTRA_SUBJECT, title);

@twestrick Ya, but the intent would be for Android, right? I’m seeing this issue on iOS (I haven’t tried Android).

Ahh, sorry. You didn’t mention what platform you were having issues with and I assumed Android since you mentioned Gmail.

On iOS, the plugin is setting the subject like this using UIActivityViewController.

if title != nil {
    actionController.setValue(title, forKey: "subject")

If it is working on iOS using the default mail app and not Gmail, I would still say that it is an issue with the Gmail app possibly not implementing this feature.

I am finding posts about this going back to 2015/2016 being a Gmail app issue on iOS. Here is a discussion on SO, here, here, and here and even over at React Native land.

There is a possible workaround here and here, both being similar. No idea if they actually work.

1 Like