Advertise Mobile SDKs Books Events Forum News Social Networking Support Us
Follow @iphonedevsdk on Twitter

Interface 2, Advanced iOS
Mockup & Code Gen
($9.99)

Make your own iPhone apps
and run them live!
(free)

Pic Frame Dynamo: Photo Editing
($0.99)

Abiliator
($1.99)

Want your application or service advertised on iPhone Dev SDK?

Go Back   iPhone Dev SDK Forum > iPhone SDK Development Forums > iPhone SDK Development

Reply
 
LinkBack Thread Tools Display Modes
Old 06-05-2008, 07:17 AM   #1 (permalink)
New Member
 
Join Date: Jun 2008
Posts: 1
ashishbhatt12 is an unknown quantity at this point
Default How to send email from the iPhone application??

Hi,
I am developing iPhone Application in which I want to send email to any particular email address.
So, how can I do that? Do I have to open iPhone inbuilt Mail application? Is there any inbuilt API or Class to send email.? I am totally confused how to do this. Your any answer will be appreciated.

Thanks in Advance,
Ashish Bhatt,
indiaNIC Infotech Ltd.,
Ahmedabad,Gujarat,
India.
ashishbhatt12 is offline   Reply With Quote
Old 06-05-2008, 08:33 AM   #2 (permalink)
New Member
 
Join Date: Apr 2008
Posts: 298
javid.alimohideen is an unknown quantity at this point
Default Re: How to send email from the iPhone application??

Ashish,
Currently, there is no API to call Mail's functionality, you would have to launch the Mail application from your application. But remember, when you do this it will close your application and open mail app, as third-party apps are not allowed to run in background.

Code:
-(void) sendEmail {
  NSURL* mailURL = [NSURL URLWithString: @"mailto:foo@example.com?cc=bar@example.com&subject=Greetings%20from%Cupertino!&body=Wish%20you%20were%20here!"];
  [[UIApplication sharedApplication] openURL: mailURL];
}
javid.alimohideen is offline   Reply With Quote
Old 06-05-2008, 10:04 AM   #3 (permalink)
New Member
 
Join Date: Apr 2008
Posts: 420
jeff_lamarche is an unknown quantity at this point
Send a message via AIM to jeff_lamarche Send a message via Yahoo to jeff_lamarche
Default Re: How to send email from the iPhone application??

Generally, Javid's solution is the one Apple would like you to use. In general, you shouldn't be sending stuff on the sly without the user's knowledge, but if you really need to send e-mail in your application at a time when you can't quit, then it's relatively easy to do if you're comfortable with socket programming. Apple removed the Objective-C mail delivery classes with Leopard, and there's no sendmail program running on the iPhone AFAIK, so that means you'll need to handle to communication with the server yourself. It's not that hard if you've done socket programming before - SMTP is a simple text-based protocol, but if you're not comfortable with either socket programming or CFNetwork, then you've got a lot of groundwork to cover first.

Remember, though, Objective-C is a superset of C, so if you can find C source code to do what you want, you can probably use it as long as it doesn't rely on any external libraries that don't exist on the iPhone...
__________________
Check out my iPhone Dev Blog
You can send me e-mail at my forum username at mac dot com.
jeff_lamarche is offline   Reply With Quote
Old 06-05-2008, 12:19 PM   #4 (permalink)
New Member
 
Join Date: Apr 2008
Posts: 802
scottiphone is on a distinguished road
Default Re: How to send email from the iPhone application??

Guess part of the questions is will Apple approve apps that do that type of thing.
Obviously dependent on the particular app.
scottiphone is offline   Reply With Quote
Old 06-05-2008, 06:51 PM   #5 (permalink)
New Member
 
Join Date: Apr 2008
Posts: 420
jeff_lamarche is an unknown quantity at this point
Send a message via AIM to jeff_lamarche Send a message via Yahoo to jeff_lamarche
Default Re: How to send email from the iPhone application??

and on how closely they look at the apps. It's still unanswered what the level of scrutiny will be and they will judge, which probably should make us all a little nervous.
__________________
Check out my iPhone Dev Blog
You can send me e-mail at my forum username at mac dot com.
jeff_lamarche is offline   Reply With Quote
Old 06-06-2008, 10:12 PM   #6 (permalink)
New Member
 
Join Date: Apr 2008
Location: Onomatopoeia, Lugubriousylvania
Posts: 225
bonehead is an unknown quantity at this point
Default Re: How to send email from the iPhone application??

Quote:
Originally Posted by jeff_lamarche
and on how closely they look at the apps. It's still unanswered what the level of scrutiny will be and they will judge, which probably should make us all a little nervous.
Completely agreed. One of the biggest hurdles we face is that there is going to be a tremendous bottleneck at Apple filtering through all these applications. There's been a similar bottleneck at Verizon for years, and it's difficult for good new applications to push through the noise.
bonehead is offline   Reply With Quote
Old 11-11-2008, 01:30 AM   #7 (permalink)
Registered Member
 
Join Date: Aug 2008
Age: 16
Posts: 22
pacific inter is on a distinguished road
Send a message via AIM to pacific inter Send a message via Skype™ to pacific inter
Default

that way you can send almost every character exept "&" how to fix it?
pacific inter is offline   Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to send email on using the iPhone SDK deadeasy iPhone SDK Development 4 06-16-2009 12:21 PM
Launch mail application from an iphone application satyanarayanagv iPhone SDK Development 1 06-12-2008 03:04 AM
Lock iPhone Application BigSlim iPhone SDK Development 4 05-15-2008 02:17 PM
iPhone SDK Beta 4 - How to send emails with attachments? eugene3000 iPhone SDK Development 1 04-28-2008 09:19 AM
Which Application Will Saturate The iPhone? Chris Stewart iPhone SDK Development 5 04-17-2008 09:39 AM


» Advertisements
» Online Users: 335
2 members and 333 guests
guusleijsten, LEARN2MAKE
Most users ever online was 1,387, 04-10-2012 at 04:21 AM.
» Stats
Members: 175,649
Threads: 94,113
Posts: 402,880
Top Poster: BrianSlick (7,990)
Welcome to our newest member, Anwerbl
Powered by vBadvanced CMPS v3.1.0

All times are GMT -5. The time now is 08:43 PM.
Powered by vBulletin® Version 3.8.0
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.0