Mono Touch의 MessageUI 구성 요소로 이메일 보내기

1477 단어 MessageUI
모르는 곳이 있으면 채팅방에 들어오세요.
347636249
탐구
using System;
//
using MonoTouch.UIKit;
using MonoTouch.Foundation;
using MonoTouch.MessageUI; // 
using System.Drawing;

namespace GCForum
{
	public class MyTestVC :UIViewController
	{
		public MyTestVC ()
		{
		}

		private MFMailComposeViewController _mail;
		public override void ViewDidLoad ()
		{
			base.ViewDidLoad ();
			this.View.BackgroundColor = UIColor.White;
			// 
			this.NavigationItem.SetRightBarButtonItem (
				new UIBarButtonItem (UIBarButtonSystemItem.Add, (sender,args) => {
				if (MFMailComposeViewController.CanSendMail) {
					_mail = new MFMailComposeViewController ();
					_mail.SetToRecipients (new string[] {
						"[email protected]", "[email protected]"
					});
					_mail.SetCcRecipients (new string[] { "[email protected]" });
					_mail.SetBccRecipients (new string[] { "[email protected]" });

					_mail.SetMessageBody ("hello world", false);
					_mail.SetSubject ("test email");
					_mail.Finished += HandleMainFinished;

					this.PresentViewController (_mail, true, null);
				} else {
					Utils.Tools.Alert ("Mail Not Sent");
				}
			}), true);
		}

		void HandleMainFinished(object sender, MFComposeResultEventArgs e)
		{
			if (e.Result == MFMailComposeResult.Sent) {
				Utils.Tools.Alert ("Mail Sent");
			}
			e.Controller.DismissViewController (true, null);
		}

		//...

	}
}

좋은 웹페이지 즐겨찾기