how to add sender into an HTML coded email? - iphone

I need to send an email from my iPhone app but the name of the sender needs to be included within the body.
I do not know how to do that.

If you're using MFMailComposeViewController it takes the user's 'default' email account (as set up in Settings) and the email is sent from there. AFAIK, there's no way to obtain that email address (and the name that goes with it) programmatically.
But if your app can somehow get the user to associate their sender email account (via an addressbook picker) then you could use the standard AddressBook APIs to get the sender name and then insert that into the message.
[ It's not clear from your question if you're having problems with sending email, getting user names from contacts, or compositing HTML messages. Perhaps if you edited your question and explained what you're trying to do and what you've tried you'll get a better answer. ]

Related

How to send a confirm email from swift

In my app I've a button that allows users to send me an e-mail.
When users send me an e-mail I want to send to their a confirm e-mail.
But, from swift code, how can I get their email address in order to send to their the confirm mail?
Thank you
You will not be able to use Swift to grab a user's email address this way. This is intentional, to keep a user's information secure.
I would recommended either using an email service that will automatically respond to emails received, or allowing users to enter their email address elsewhere in the app.

Getting a List of My Email Recipients who have viewed my email?

Trying to get a list of my email recipients who have seen my email, and then to use a different medium to address who didn't see (via SMS/Call).
I could get the number of people who saw the email by having a hit counter set up in a web server, looking for a method to get this done now. Any help?
Thanks.
It can't be done reliably. Popular email clients will not do anything to alert the sender that an email was received because this allows spammers to detect if the email address is valid. That's why most email clients block remote images until the user clicks "Show Images" because the images could be used for this purpose.
Email system support something called a "read receipt" that is intended for this use but most clients will never send one.
You can detect if an email bounces but receiving an email and viewing an email are two different things.

Custom email form in iPhone app?

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.

Check to see if email is enabled?

I'm working on an iPhone app that, at a certain point, will try to send an email message. If the user has an email set up, great, if not, I need to change some actions accordingly. My question is how do I check to see if the user's iPhone has an email account setup? I've looked everywhere but I can't seem to find an answer.
I'm using MFMailViewController to send the message, but I don't want to create an instance of it unless I can actually send something. Any ideas?
MFMailComposeViewController class has +canSendMail method which
Returns a Boolean indicating whether
the current device is able to send
email. (YES if the device is configured for sending email or NO if it is not.)

access default email address

I am using the MFMailComposeViewController in 3.0 to send an email with attachment etc. inside my app. I would like the "To:" address to be defaulted to the default account/address on the device. How can I access this address to place it into a string for the setToRecipients?
Essentially, I'm going to let the user send an email to themselves (as the default "To") with an attachment inside the app.
The API doesn't expose that information publicly (for probably good reasons, such as preventing developers from harvesting iPhone users' email addresses).
You should probably go about asking for the user's email address and then saving it for future use.
It appears that the accepted answer is wrong
Getting user's default email address in Cocoa
This answer shows the code for getting the e-mail address from the address book ( listed under 'me' )
EDIT: Note the comment! OSX only not iOS :|
You can use ABGetMe for iOS to get the user's address book card. Have a look at the source code, you will see how to retrieve all e-mail addresses for a given ABRecordRef.