I am sending mail from the mail composer in iphone. I want to know the name from so that send "hello username" in the message body.
Is there is any way to get the username in mail composer.
Once the MFMailComposeViewController is visible you can't change the email. You have absolutely no control over the content of the mail once the view controller is visible.
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.
The user can enter the recipient name on his own, or you can set it initially.
Go through this
http://developer.apple.com/library/ios/#documentation/MessageUI/Reference/MFMailComposeViewController_class/Reference/Reference.html
Related
Is there a way to send an email from my iOS application without showing the real email address of the recipient?
It would be better if I could hide it completely.
No - this isn't possible and makes little to no sense anyway. (See the existing MFMailComposeViewController and privacy - hiding the To: field? and How to customize MFMailComposeViewController so that i can make the "to" field as non-editable? questions/answers amongst others.)
Additionally as per the MFMailComposeViewController Class Reference docs:
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.
However, there's nothing to stop you using a different SMTP client than the built-in one (https://github.com/jetseven/JSMailSender for example) or simply sending the relevant data (via your own app) to a server which then uses this to construct and transmit an email, although this obviously wouldn't have the iOS device's default "owner" email address or indeed any other details unless they were supplied within your app.
If you want to achieve this you can make a web service and send the recipient list to the web service and if the web service is made in php then it is easy to send an email using just a simple mail function in php. So in this way you can hide the recipients and send an email.
If I were to send an email from any ios app (non built in apps) then can I change
'from' (some default id) to some other id.
Say gmail is my default email set up in MAIL App. So can I use my other email account to send
email even if I use gmail as default mailing option.
I am looking to implement this functionality for my ios app.
Is it possible and is there any way to achieve this using coding?
There is no method for this listed in the Apple Documentation on MFMailComposer, and Apple does not like people messing with MFMailComposer. So no.
From the documentation:
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.
I have a nicely designed mail sending page that I have to implement. I would like to use MFMailComposeViewController to achieve this task but this comes with its own regular view. What are my options? Is there a way to use my own view with MFMailComposeViewController? Or maybe another way to send emails from the app that allow me to customize the view?
Thanks!
You may not change MFMailComposeViewController in any way. Quoth the documentation:
Important: The mail composition interface itself is not customizable and must not be modified by your application.
As far as I know, there is no other built-in way to send email from the device.
Your only other option would be to have the device contact a server of your own which would forward the email message, but then of course the message wouldn't be coming from the email address associated with the device and such.
Anomie is correct.
We created an app which had used a backend email server to send anonymous emails and we had a custom front end to collect the user message. However if you're just thinking that the composition interface needs a makeover it's really not a good approach and almost certainly will get you slammed during the submission process.
Best Reason for not messing with the interface -
. User will question authenticity of any email interface which does not resemble Apple's email interface.
I need to disable the TO address on compose mail UI. Because i used static email address. Also i don't want CC/Bcc address. How to remove CC/Bcc address on compose mail UI? I'm using MFMailComposeViewController for sending email.
I'm using MonoTouch. How to achieve this one?
You cannot do that, and there's a good reason.
Apple's approach to UI design is to make sure user is always in control.
If you present user with an email form, you should be prepared she might want to cancel and save it as a draft for later, add her other email address to CC, or even change To address if she really wants to.
The documentation for MFMailComposeViewController explicitly states:
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.
To sum up, if you don't want user to be in control of target address, perhaps you should consider sending an email bypassing the MFMailComposeViewController UI.
Say I want to send email to my server, but I want the user to not see my address, or perhaps I want the subject to be preset. What if I want to email the value of a UISlider or other UI element without the user seeing the whole email view. How can I do that?
Must I use an Apple class, or can I use my own UITextFields?
The benefit of the Apple class is that you get the email address of the user. If you do not care about that, you can submit anything you want to your own server as POST data or by whatever means you wish. The interface can look like mail but the functionality will be like a web form.
If you need the address of the user and do not want to ask for it, then you will have to reveal the destination email address. You can specify a subject and body, but the user will be able to modify it.