getting from email address when using MFMailComposeViewController - objective-c

i want to show user from which account he is going to send email when he is going to send an email using my app and i am using MFMailComposeViewController. so what is the way of getting the from email address.

There is no way to get this information. Mail sent via MFMailComposeViewController is always sent from the user's default address.

Mail sent via MFMailComposeViewController is always sent from the user's default address.
User's default address is selected by default but the user can switch the accounts. Anyway, no way to get this info back into your app.

Related

Ionic 4 Firebase Pushnotification

I need to know is it possible to need to send some type ID with firebase notification. Where user get notification i want to open the page and pass that ID as a parameter in api ? Is it possible ? OR any one have example ? Thanks
Depending on your need you can send a notification message, or data message, the notification message will be basically responsible for showing a push notification to the device with a title, subtitle and message depending on the operating system (in terms of the graphic environment), the data message will send a notification to the device with the data you want, this notification will not be visible to the user, now if you need to send data but also show a notification to the user you can do it in two ways:
You send a notification of data, when you receive it you process it, you show a local notification and you send by parameter the id that you received.
Send a push notification (with the id specifically in some side as you wish) this is shown by default to the user, when the user opens it, you process the id, and send it by parameter.
I recommend the first option, here you will find more information
Firebase Cloud Messaging

How to save the user's email recipients when sending email with UIActivityViewController?

I'm using UIActivityViewController and when the user selects email from the list of options is there a way to save the email recipients that the user inputs?
Do I need to subclass ActivityItemSource as was done here?
I realize getting the email recipients is tricky even with just using MFMailcomposeViewController as in here.
Do I need to subclass MFMailcomposeViewController to save the email recipients that the user inputs?
From the class reference:
Important: The mail composition interface itself is not customizable
and must not be modified by your application. In addition, after
presenting the interface, your application is not allowed to make
further changes to the email content. The user may still edit the
content using the interface, but programmatic changes are ignored.
Thus, you must set the values of content fields before presenting the
interface.
So, no. You should not subclass MFMailcomposeViewController in order to "steal" the email addresses that the user has entered. This is a privacy issue, and Apple specifically designed it this way. If you try to circumvent this, then your app very likely will be (and should be) rejected.

Xcode in app email adding a From text field

Ok, so I have successfully made my first in-app Email app using MFMAilComposer. I have the toRecipients textfield added, as well as subject and body etc. So I understand that the email will not send if I use the simulator and will send with an iPhone. However, when a person receives the email, how is that person supposed to know whom he received it from? With this in mind, a "From" field should be in order. I appreciate all answers, and thanks in advance :)
You don't have to handle this, the mail composer does it for you. When the composer is shown it defaults to the users default email account but if they want to choose which email address they are sending from they can simply tap their email and a list will expand allowing them to choose from which of their emails to send the message.

Check recipient email address with MFMailComposeViewController

I have a question about the MFMailComposeViewController for sending an Email in an app. Is it possible to check the recipient adress before sending the email ?
I did not find any response so i think it's not possible..
If it's not possible, there is other solution ?
When you present the MFMailComposeViewController you lose complete control over it.
You can't do anything with it, neither get the "To" email address nor prevent the sending of the mail.
From the documentation:
Important: The mail composition interface itself is not customizable and must not be modified by your application. In addition, after presenting the interface, your application is not allowed to make further changes to the email content. The user may still edit the content using the interface, but programmatic changes are ignored. Thus, you must set the values of content fields before presenting the interface.

How can I send email from my application?

I want to attach a video and send email from my application.
I downloaded apples example code MailComposer. I compiled it. I did not get any errors or warnings.
I sent the mail to my mail id. But, I could not see any mail in my inbox. I am working on simulator.
I did not set any senders email id in simulator.
How can I know whether the code is working or not ?
Thank You.
The simulator cannot send email; nor can all devices, as you'll discover if you use the MFMailComposeViewController +canSendMail method—it returns NO if the device doesn't have a mail account set up. To quote the documentation:
You should call this method before attempting to display the mail composition interface. If it returns NO, you must not display the mail composition interface.