MFMailComposeViewController with recipient display-name as well as email address - iphone

I find that I can
[picker setToRecipients:[NSArray arrayWithObject:#"My Name <myname#example.com>"]];
and it nicely displays "My Name" in the To: field when composing the email, and delivers it correctly to myname#example.com, on my iPad device. Looks good in the iPad simulator too (can't send though of course).
But the iPhone simulator just shows "1 recipient" on the compose screen. Don't know whether it would send it ok or not, don't have an iPhone device handy to test that.
Has anyone else gone down this path? Any way of getting the display-name on the iPhone compose screen?
Thanks

OK got it. There is a 40-character limit on the display name. When I figured this out and googled "email display-name 40" I find there other (non-Apple) references to a 40-char limit. RFC possibly. Perhaps I should have included the real display-name and email address in my question ;)

If you don't give the name of the recipient then also it will display the name as you have stored the email & name in your iPAD contacts.
If you store the name & email in contact it will display.

Related

Display recipients name instead of mail address in MFMailComposer

Is it possible to display or show the recipient name in Recipient field instead of the email address. I found this reference but doesn't understand what is done.
Can anyone guide for above. Is there any way to display name instead of email address.
Got the solution from the question itself.
#"My Name <myname#example.com>"

How to get email address from MFMailComposeViewController

Application is sending email by using MFMailComposeViewController, everything works just fine. However after sending email, the recipient address needs to be stored for further processing. As far as I can tell, there is no API for this.
How do I get the email address where message was sent to?
Should I subclass MFMailComposeViewController and override something? What would that be?
Could I find email address by looking at MFMailComposeViewController view hierarchy? What would I be looking for there?
Any other ideas?
Figured out a partial answer, here's the details:
http://jomnius.blogspot.com/2011/02/how-to-find-mfmailcomposeviewcontroller.html
Problems: it finds the recipient email address(es), but only if that fits in about 35 character text string. Otherwise you find only a summary string like "aaa#aaa.aa & 2 more...". So where are the actual email addresses in this case?
As an alternate UI flow -- though obviously I don't know your app, so only you'll know whether this can work -- you could instead have the user enter recipient info into a textfield and then push the mail composition viewcontroller (with the recipient(s) pre-filled).
You could even use a variation of Joe Michel's Multi-Recipient Picker library to make it feel more like the native recipient selection.

Why does iPhone eMail signature go out as an attachment?

I am building an iPhone application that generates an email with an attachment. The eMail message window pops up showing the body text and attachment followed by the default "Sent from my iPhone" signature text.
Everything seems perfectly ok, except when the message is received by the recipient the signature "Send from my iPhone" has been converted into a text attachment instead of remaining as the last line of the body. What gives?
Update: It seems that it's only Outlook that exhibits this behaviour. When I view the message in iPad Mail the signature does show as body text, not an attachment.
How does the email view in other applications, such as Apple Mail, Eudora, Lotus Notes, Thunderbird, etc ?
I'm suspecting that it's to do with Outlook's anal attempts to "protect the user experience", the same as it does if you email an EXE file (won't let the recipient open it).
It's an Outlook issue. Go to Options, Mail, Message Format, then UNCHECK "Reduce message size by removing format information...." Click here to see:
Outlook Options

Embed indentifier within an Email

I am trying to embed an ID into an email so that when a recipient replies to an email that my system sends out, my system can pick it up and match the two together.
I have tried appending a custom header, however this is stripped out when the user replies.
I have tried embedding an HTML comment within the email, but outlook does not seem to keep comments when a reply email is created.
Worst case scenario, I can manually try and match the sent and received emails by time span or have a visible tag within the message body.
Does anyone know of a more elegant solution?
Thanks in advance
Email messages already contain such an identifiers, called Message-ID. And there's even a way to send which message you're replying to by sending that ID in a header called In-Reply-To. That's done by pretty much all email clients, that's how they usually do their threading.
It's defined in RFC 822 (yep that's pretty old) and probably re-defined and refined in more modern versions of that.
I have seen a method that includes a one byte image with a unique name that's linked to the user. When they view the email and download the images, your HTTP server will record a hit for that unique image. Of course the user needs to display images, but you can include a message in the body asking them to display the images. We actually include content in an image so they need to show images.
If your incoming e-mail can handle +foo or -foo suffixes, use that.
Many e-mail systems can route user+foo#example.com or user-foo#example.com
to user#example.com. You can replace foo with some kind of identifier.
Several mailing list servers use this for tracking bounces.
While I can't say for certain, my investigation in that sort of matter some time ago yielded the following "conclusion":
Headers are transformed a lot
Message bodies are transformed a lot
This is partly because, I suspect, of:
Need to protect users from malicious intentions
Need to perform "targeted marketing"
I have seen "unique codes" flying around in clear text in the email body but I would suggest having a unique identifier embedded in the return address instead.
The usual approach is to place the id in the subject line and/or somewhere visible in the message text and informing the recipient that he should not modify the subject or quote the original mail when responding.

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 from my iPhone." Is there anyway to modify this text or prevent it from appearing? A cursory review of the MFMailComposeViewController Class Reference and quick Googling doesn't turn up anything.
Thanks in advance.
As far as I know, this is a global mail setting that can be specified by the user. By default the signature is set to "Sent from my iPhone", but it can be changed in Settings - Mail,Contacts,Calendars - Signature
If you are referring to the signature in the iPhone Simulator, it's just there by default. There's no Mail.app and therefore no settings for Mail to disable it. You can't actually send an email either, but it's just nice that they at least enabled MPMailComposeViewController. If you use MFMailComposeViewController, the user's signature on their own device will display in the bottom of your custom app message.
No actual programmatic way to do this.
It is using signature from Settings.
To remove the signature on your phone, open Settings app, type Signature and tap Signature option from the list, as in image.
You will be prompted a textfield which you can leave empty to remove the signature:
You can add some kind of signature programmatically, using preset text:
let mail = MFMailComposeViewController()
mail.setMessageBody("<br><br><br><p>Some user metadata here</p>", isHTML: true)
and it will look like this, assuming user has deleted his signature in Settings, otherwise signature will be below Some user metadata here: