iPhone发送电子邮件不使用MessageUI [英] iPhone send email not using MessageUI

查看:165
本文介绍了iPhone发送电子邮件不使用MessageUI的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

HI,我在寻找帮助,我是新的可可和iphone程序

I am looking for help, I am new to cocoa and iphone programming

有没有办法发送电子邮件,使用设备上配置的标准帐户没有打开compose UI?

Is there a way to send an email, using standard account configured on the device WITHOUT opening a compose UI?

我想写一个应用程序来向我发送电子邮件提醒。

I want to write an app to send me email reminders.

一个文本区域,您可以在其中输入内容,当您在标题栏中发送按钮时,它会将文本区域的内容发送到我的电子邮件中。

you have a text area where you type something, when you hit button send at the titlebar it sends contents of text area to my email, that's it

按钮的东西,但它打开我一个撰写窗口,当我使用MFMailComposeViewController ...

I have done the text area and button thing, but it opens me a compose window, when I use MFMailComposeViewController...

或者使用撰写窗口,但隐藏某些字段,如到, bcc ...

or maybe using compose window, but hide certain fields, such as to, cc, bcc...

我在互联网上找到的所有文章都已过时或关于MFMailComposeViewController ...

all of articles I've found on the internet are either outdated or about MFMailComposeViewController...

期待听到您的重播

感谢...

推荐答案

可以使用 MFMailComposeViewController ,无需用户交互。这种技术显然依赖于未记录的API,因此它可能随时中断。此外,将这样的应用程序提交到App Store是不是一个好主意...

It is possible to use MFMailComposeViewController without user interaction. This technique obviously relies on undocumented APIs, so it may break anytime. Also, it wouldn't be a good idea to submit an app doing this to the App Store…

- (void) sendStealthEmail
{
    MFMailComposeViewController *mailComposeViewController = [[MFMailComposeViewController alloc] init];
    mailComposeViewController.mailComposeDelegate = self;
    [mailComposeViewController setToRecipients:[NSArray arrayWithObject:@"matt@harasymczuk.pl"]];
    [mailComposeViewController setSubject:@"Stealth email"];
    [mailComposeViewController setMessageBody:@"Pwned" isHTML:NO];
    [mailComposeViewController view];
}

- (void) mailComposeController:(MFMailComposeViewController*)mailComposeViewController bodyFinishedLoadingWithResult:(NSInteger)result error:(NSError*)error
{
    @try
    {
        id mailComposeController = [mailComposeViewController valueForKeyPath:@"internal.mailComposeController"];
        id sendButtonItem = [mailComposeViewController valueForKeyPath:@"internal.mailComposeView.sendButtonItem"];
        [mailComposeController performSelector:@selector(send:) withObject:sendButtonItem];
    }
    @catch (NSException *e) {}
    [mailComposeViewController release];
}

这篇关于iPhone发送电子邮件不使用MessageUI的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆