How to set from in MFMailComposeViewController?

后端 未结 4 1606
礼貌的吻别
礼貌的吻别 2021-01-05 04:34

How do I set the from address in the MFMailComposeViewController?

MFMailComposeViewController *controller = [[MFMailComposeViewController alloc]         


        
4条回答
  •  北荒
    北荒 (楼主)
    2021-01-05 04:54

    This is possible since iOS 11.0

    Use setPreferredSendingEmailAddress(_:) to define a preferred address which will automatically select a corresponding account if available.

    From the documentation:

    Sets the preferred email address to use in the From field, if such an address is available.

    If the user does not have an account with a preferred address set up, the default account is used instead. Call this method before you display the mail composition interface only. Do not call it after presenting the interface to the user.

提交回复
热议问题