How can I send email from my application? - cocoa-touch

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.

Related

Send message from iPhone without open MFMessageComposeViewController

I have made one application, In my application I want to send message on some mobile no.
I know, this is done using MFMessageComposeViewController.
but, can we send message without open the MFMessageComposeViewController ?
Can we use MFMessageComposeViewController in background and send message on some mobile no ?
any one has idea then pls help me...
As we said before (you can search here in StackOverFlow), user interaction has to be called.
What if your application send spam messages ? What if it send message to a plateform you own with taxed messages ?
So the answer is no.
you can use ShareKit without UI but you cant do that for mail or SMS

iOS 6 send email without user interaction

First of all, I'm working on an in-house app, so I don't need approval at App Store. I know it wouldn't ever be accepted, but it's a business rule our users share some content of the application, but with a default message and subject, so they can't edit these fields..
Until iOS 5 I was able to navigate by the view hierarchy and let the fields unneditable. But with iOS 6, and the mail on another proccess, I can't do it anymore.
I need to block the views for editing (I put a view over all the mail view, except the title bar, and it works, but when the user try to cancel the e-mail, my view is blocking the popover to delete or save draft too) or send e-mails without the UI (I was able to do it with Stealth Messenger based code (https://github.com/0xced/Stealth-Messenger/) at iOS 4 or 5, but now it doesn't work).
I tryed everything I could with private APIs and Objective-C runtime.. I can dismiss the view with sending e-mail ok, but the e-mail itself isn't sent.
Can anybody help me? Does anybody did it?
Thanks in advance..
Take a look at this: Send Email in Background from iOS
IOS doesn't support to mail in background. [...] As an alternate you
should implement the WebService for this[...]
Probably the best option is to utilise some server code and call that with NSURLRequest.
Hope that helps.
I do this in an app of mine. I have a simple PHP script on a webserver that uses the PearPHP mail modules to send SMTP mail. The PHP script takes a few incoming variables, like $toAddress, $subject, $message and then connects to the SMTP server and sends the mail out.
Unfortunately, you're not allowed to subclass the MFMailComposeViewController, and if you were using some sort of Invisible UIView to block fields, that was just a workaround that's probably been broken. (They did the same thing with being able to insert a "." on the NumberPad keyboard)

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.

Create an iPad application for sending the selected photo as an attachment in an email

I need to Create an iPad application for sending the selected photo as an attachment in an email.
The TO and CC address can be typed or must be able to select from contacts if they have email address added.
As I am a new guy in iPhone/iPad application can any one provide me a good way to do it. Any sample apps, paths to refer.
I recommend you take a look at MFMailComposeViewController in the documentation. The examples there will help. You'll want to include the MessageUI.framework as well. This should get you going with mailing within an app.
For the picture side, check out UIImagePickerControllerDelegate.

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.