Questions tagged [mfmailcomposeviewcontroller]

The MFMailComposeViewController class provides a standard interface that manages the editing and sending of an email in iOS.

As mentioned here

The MFMailComposeViewController class provides a standard interface that manages the editing and sending of an email. You can use this view controller to display a standard email view inside your application and populate the fields of that view with initial values such as the subject, email recipients, body text, and attachments. The user can edit the initial contents you specify and choose to send the email or cancel the operation.

Using this interface does not guarantee immediate delivery of the corresponding email message. The user may cancel the creation of the message, and if the user does choose to send the message, the message is only queued in the Mail application outbox. This allows you to generate emails even in situations where the user does not have network access, such as in airplane mode. This interface does not provide a way for you to verify whether emails were actually sent.

Before using this class, you must always check to see if the current device is configured to send email at all using the canSendMail method. If the user’s device is not set up for the delivery of email, you can notify the user or simply disable the email dispatch features in your application. You should not attempt to use this interface if the canSendMail method returns NO.

To display the view managed by this view controller, you can use any of the standard techniques for displaying view controllers. However, the most common way to present this interface is do so modally using the presentModalViewController:animated: method. Figure 1 shows the view that is displayed when you present the mail composition interface, with some of the fields already filled in. For more information on displaying the views associated with view controllers, see View Controller Programming Guide for iOS.

Important: The view hierarchy of this class is private and you must not modify it. You can, however, customize the appearance of an instance by using the UIAppearance protocol. After presenting a mail comopose view controller, your app cannot change the email content. The user can edit the content of a presented instance but the system ignores programmatic changes. If you want to set values for the content fields, do so before presenting the interface

905 questions
18
votes
6 answers

MFMessageComposeViewController cancel button not working

I use this block to send message to the contacts, after sending, the back button is there, but when I touch it nothing happens. Please help me out :) -(IBAction) InviteIt:(id) sender{ if ([MFMessageComposeViewController canSendText]) { …
user4034591
17
votes
1 answer

iOS 12.0 : Is there a way to set MFMailComposeViewController navigation bar title's text to white?

Currently, I haven't found a way to do this for iOS 12.0. I've tried setting bar tint like so. [mailController.navigationBar setTintColor:[UIColor whiteColor]]; Then, I tried setting the title text attribute with the following code …
16
votes
2 answers

How to change boilerplate "Sent from my iPhone" text in MFMailViewController message body?

I'm using the MFMailComposeViewController to send an email from within an iPhone v3.0 application. I programmatically create the message body text and display it before showing the picker. At the bottom of my message body text is the string "Sent…
billmaya
  • 1,253
  • 3
  • 14
  • 34
16
votes
2 answers

iOS6: MFMailComposeViewController slow to load and flashes black screen; MailCompositionS begins hogging memory

On iOS 6, after sending a few email messages (by using MFMailComposeViewController), the email screens become very slow to open- at first opening with none of the fields populated (no Subject, no body, etc.) for a few seconds, and eventually (after…
15
votes
1 answer

iPhone - MFMailComposeViewController delegate incompatible type

I have a view controller which opens an MFMailComposeViewController modally. When I try to set the mail view controller's delegate to the parent view controller, I get this warning: Assigning to 'id' from…
Rob
  • 9,433
  • 12
  • 52
  • 87
15
votes
7 answers

MFMailComposeViewController does not dismiss

I'm trying to implement MFMailComposeViewController in case of sending the emails from within my application. The problem is that after presenting MFMailComposeViewController it is not dismissing by "Cancel" or "Send" buttons, just a bit scrolls…
Pavel Zagorskyy
  • 413
  • 1
  • 4
  • 17
15
votes
10 answers

How to display Underlined Text in a Button on iOS?

I want to display the mail ID in my view such that clicking the mail ID should open the mail composer view. I want to display the button text as underlined to show it is a hyperlink and for the button click event to call the mail composer view. At…
Warrior
  • 37,935
  • 44
  • 133
  • 211
14
votes
5 answers

how to send a mail from my iOS application- SWIFT

I want to send a mail from my application. I am doing my first steps with SWIFT and i have stuck at a point. I want to press a button and open up the mail. Can you please tell me how to do the button connection? I think it should be an action but I…
jonathan
  • 159
  • 1
  • 1
  • 6
14
votes
1 answer

_UIViewServiceInterfaceErrorDomain

I'm having a problem with MFMailComposeViewController I'm getting this error viewServiceDidTerminateWithError: Error Domain=_UIViewServiceInterfaceErrorDomain Code=3 "The operation couldn’t be completed. (_UIViewServiceInterfaceErrorDomain error…
macuser101
  • 141
  • 1
  • 1
  • 3
14
votes
5 answers

MFMailComposeViewController : how do I embed a clickable URL link into the email message body

I want my app using the MFMailComposeViewController to send an email such that the recipient can click on the embedded url to open the corresponding web site. MFMailComposeViewController does not appear to support this explicitly. Any ideas?
rudifa
  • 179
  • 1
  • 3
  • 12
14
votes
6 answers

Change title of MFMailComposeViewController

I'm using MFMailComposeViewController for in-app email in my app, but I'm not able to change the title. As default it's showing the subject in the title, but I would like to set the title to be something else. How can I do that? I've…
14
votes
2 answers

Attaching .txt to MFMailComposeViewController

I have a .txt file stored in Documents Folder and I want to send it by MFMailComposeViewController with next code in the body of -sendEmail method: NSData *txtData = [NSData dataWithContentsOfFile:[[NSBundle mainBundle] pathForResource:@"dataBase"…
Alex
  • 1,599
  • 3
  • 19
  • 36
14
votes
6 answers

MFMailComposeViewController's Cancel Button (action sheet possibly) freezes the view

I've seen several questions before such as this but for the lack of an accepted answer as well as having implemented everything as needed I still continue to face the issue as follows: I display the mail composer but on clicking cancel, the composer…
13
votes
1 answer

dismissModalViewController Hides the parent view behind status bar

I have a very strange issue here. I am using a present modal view controller to display my MFMailComposer ViewController on top of a ViewController which is placed with in a Navigation Bar. [self presentModalViewController:emailviewController…
Kunal Balani
  • 4,531
  • 3
  • 32
  • 72
12
votes
3 answers

How to change buttons in MFMailComposeViewController?

In my app I am using the MFMailComposeViewController. I have placed a back and Done button in the title bar. I have the title bar to be in black color, but I have the button background in blue color. How to change the button background color to…
Siva K
  • 4,802
  • 14
  • 76
  • 156
1
2
3
60 61