<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>iPhone Tutorial &#124; iPhone iOS4 iPad SDK Development &#38; Programming Blog &#187; Mail Send</title>
	<atom:link href="http://www.edumobile.org/iphone/tag/mail-send/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.edumobile.org/iphone</link>
	<description></description>
	<lastBuildDate>Wed, 25 Jan 2012 09:42:29 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.1</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Mail Send from iPad</title>
		<link>http://www.edumobile.org/iphone/ipad-development/mail-send-from-ipad/</link>
		<comments>http://www.edumobile.org/iphone/ipad-development/mail-send-from-ipad/#comments</comments>
		<pubDate>Mon, 26 Jul 2010 07:07:45 +0000</pubDate>
		<dc:creator>Sushant</dc:creator>
				<category><![CDATA[iPad Development]]></category>
		<category><![CDATA[iPad tutorials]]></category>
		<category><![CDATA[Mail Send]]></category>
		<category><![CDATA[Mail Send from iPad]]></category>

		<guid isPermaLink="false">http://www.edumobile.org/iphone/?p=2504</guid>
		<description><![CDATA[This is the very simple application. In this application we will see how to mail send from the iPad.]]></description>
			<content:encoded><![CDATA[<p>This is the very simple application. In this application we will see how to mail send from the iPad.</p>
<p><strong>Step 1:</strong> Create a View base application using template. Give the application name “MailComposer”.</p>
<p><strong>Step 2:</strong> Xcode automatically creates the directory structure and adds essential frameworks to it. You can explore the directory structure to check out the content of the directory.</p>
<p><strong>Step 3:</strong> Expand classes and notice Interface Builder created the MailComposerViewController class for you. Expand Resources and notice the template generated a separate nib, MailComposerViewController.xib, for the “MailComposer”.</p>
<p><strong>Step 4:</strong> We need to add MessageUI Framework. Select Frameworks folder -&gt;Add -&gt; Existing Framework -&gt; Add MessageUI Framework.</p>
<p><strong>Step 5: </strong>In the MailComposerViewController.h file , we have import MessageUI framework. Create an instance of UIButton class and add one buttonPressed method. So make the following changes in the file.</p>
<div class="codesnip-container" >
<div class="objc codesnip" style="font-family:monospace;"><span class="co1">#import &lt;UIKit/UIKit.h&gt;</span><br />
<span class="co1">#import &lt;MessageUI/MessageUI.h&gt;</span></p>
<p><span class="kw1">@interface</span> MailComposerViewController <span class="sy0">:</span> UIViewController <br />
&lt;MFMailComposeViewControllerDelegate&gt;<br />
<span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; IBOutlet UIButton <span class="sy0">*</span>button;<br />
<span class="br0">&#125;</span></p>
<p><span class="sy0">-</span> <span class="br0">&#40;</span>IBAction<span class="br0">&#41;</span>buttonPressed;</div>
</div>
<p><strong>Step 6:</strong> Double click MailComposerViewController.xib file and open it to the Interface Builder. First drag the Round Rect button from the library and place it to the view window. Connect File&#8217;s Owner icon to the View icon and select view. Drag File&#8217;s Owner icon to the round Rect button and select button and select the Round Rect button and bring up Connection Inspector next drag Touch Up Inside to the File&#8217;s Owner icon and select buttonPressed: action. Now save the MailComposerViewController.xib file, close it and go back to the Xcode.</p>
<p><strong>Step 7:</strong> Open the MailComposerViewController.m file and make the following changes in the file.</p>
<div class="codesnip-container" >
<div class="objc codesnip" style="font-family:monospace;"><span class="sy0">-</span> <span class="br0">&#40;</span><span class="kw4">void</span><span class="br0">&#41;</span>viewDidLoad <span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">if</span> <span class="br0">&#40;</span><span class="br0">&#91;</span>MFMailComposeViewController canSendMail<span class="br0">&#93;</span><span class="br0">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; button.enabled <span class="sy0">=</span> <span class="kw2">YES</span>;<br />
<span class="br0">&#125;</span></p>
<p>
<span class="sy0">-</span> <span class="br0">&#40;</span>IBAction<span class="br0">&#41;</span>buttonPressed <span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; MFMailComposeViewController <span class="sy0">*</span>mailController <span class="sy0">=</span> <span class="br0">&#91;</span><span class="br0">&#91;</span>MFMailComposeViewController alloc<span class="br0">&#93;</span> init<span class="br0">&#93;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; mailController.mailComposeDelegate <span class="sy0">=</span> self;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#91;</span>mailController setSubject<span class="sy0">:</span><span class="co3">@</span><span class="st0">&quot;Hello World&quot;</span><span class="br0">&#93;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#91;</span>mailController setMessageBody<span class="sy0">:</span><span class="co3">@</span><span class="st0">&quot;This is the MailSend Application&#8230;.&quot;</span> isHTML<span class="sy0">:</span><span class="kw2">NO</span><span class="br0">&#93;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#91;</span>self presentModalViewController<span class="sy0">:</span>mailController animated<span class="sy0">:</span><span class="kw2">YES</span><span class="br0">&#93;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#91;</span>mailController release<span class="br0">&#93;</span>;<br />
<span class="br0">&#125;</span></p>
<p><span class="sy0">-</span> <span class="br0">&#40;</span><span class="kw4">void</span><span class="br0">&#41;</span>mailComposeController<span class="sy0">:</span><span class="br0">&#40;</span>MFMailComposeViewController<span class="sy0">*</span><span class="br0">&#41;</span>mailController didFinishWithResult<span class="sy0">:</span><span class="br0">&#40;</span>MFMailComposeResult<span class="br0">&#41;</span>result error<span class="sy0">:</span><span class="br0">&#40;</span><a href="http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSError_Class/"><span class="kw5">NSError</span></a><span class="sy0">*</span><span class="br0">&#41;</span>error <span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#91;</span>self becomeFirstResponder<span class="br0">&#93;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#91;</span>self dismissModalViewControllerAnimated<span class="sy0">:</span><span class="kw2">YES</span><span class="br0">&#93;</span>;<br />
<span class="br0">&#125;</span></div>
</div>
<p><strong>Step 8:</strong> Now Compile and run the application in the Simulator.</p>
<p><a href="http://www.edumobile.org/iphone/wp-content/uploads/2010/07/1-75.jpg"><img src="http://www.edumobile.org/iphone/wp-content/uploads/2010/07/1-75-232x300.jpg" alt="" title="1-7" width="232" height="300" class="alignnone size-medium wp-image-2509" /></a></p>
<p>You can <strong>Download SourceCode</strong> from here <a href="http://www.edumobile.org/iphone/wp-content/uploads/2010/07/MailComposer.zip">MailComposer</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.edumobile.org/iphone/ipad-development/mail-send-from-ipad/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
	</channel>
</rss>

