我是iphone應用程序開發的新手,我創建了自己的應用程序,我想知道我們是否可以爲我們自己的應用程序設置電子郵件地址,或者我們只需使用在iphone中設置。如果我們可以請給我一個如何去做的想法。我自己的iPhone應用程序中的電子郵件設置
由於提前 AKHIL
我是iphone應用程序開發的新手,我創建了自己的應用程序,我想知道我們是否可以爲我們自己的應用程序設置電子郵件地址,或者我們只需使用在iphone中設置。如果我們可以請給我一個如何去做的想法。我自己的iPhone應用程序中的電子郵件設置
由於提前 AKHIL
郵件應用程序內發送將只使用默認的郵件帳戶設置。
編輯: 下面是一個簡單sendEmail()方法:
-(IBAction) sendEmail{
if(![MFMailComposeViewController canSendMail]){
//show info msg to user
return;
}
MFMailComposeViewController *controller = [[MFMailComposeViewController alloc] init];
controller.mailComposeDelegate = self;
[controller setSubject:@"Hello"];
[controller setMessageBody:@"How are you?" isHTML:NO];
[controller addAttachmentData:UIImageJPEGRepresentation(myImage,0.8) mimeType:@"image/jpeg" fileName:@"fileName.jpg"];
[self presentModalViewController:controller animated:YES];
[controller release];
}
您將需要爲附件addAttachmentData
方法。
您還需要實現didFinishWithResult方法丟棄MFMail控制器
-(void) mailComposeController:(MFMailComposeViewController *)controller didFinishWithResult:(MFMailComposeResult) result error:(NSError *) error{
[self becomeFirstResponder];
[self dismissModalViewControllerAnimated:YES];
}
確保你的,你寫這些methos該類實現了< MFMailComposeViewControllerDelegate>協議
希望這有助於!
你可以打開任何服務器/端口的插座,並執行任何你想要採取的行動。如果您有自己的SMTP郵件服務器,可以接受「電子郵件」,從自己的應用程序很容易地:
EHLO <some identifier>
MAIL FROM: <[email protected]>
RCPT TO: <[email protected]>
DATA
email goes here
QUIT
詳見RFC 2821。
我完全不理解。什麼郵件? – willcodejavaforfood 2010-02-17 20:31:53
我認爲作者在這裏試圖找出我們是否可以使用非默認郵件帳戶從應用程序發送電子郵件(默認是我們在設置中配置的帳戶) – 2010-02-17 20:39:43