iPhone 应用程序中的 MFMailComposeViewController

发布于 2024-11-02 08:39:02 字数 892 浏览 2 评论 0原文

大家好,

我们可以使用“MFMailComposeViewController”而不使用“presentModalViewController”,我的意思是我需要发送电子邮件而不导航到该邮件编辑器页面

我用以下代码做了一个测试项目,

- (IBAction)buttonPressed {
    arrRecipients = [[NSMutableArray alloc]init];
    [arrRecipients addObject:@"[email protected]"];


    MFMailComposeViewController *mailController = [[MFMailComposeViewController alloc] init];
    mailController.mailComposeDelegate = self;
    [mailController setSubject:@"Ravikiran test mail"];
    [mailController setToRecipients:arrRecipients];

    [mailController setMessageBody:@"this is my test app" isHTML:YES];
    [self presentModalViewController:mailController animated:YES];
    [mailController release];
}

它正在发送邮件,但它正在导航到邮件编辑器页和然后它正在发送,但我需要只需单击按钮即可发送邮件

hii every one

can we use " MFMailComposeViewController " with out using " presentModalViewController" , i mean i need to send email with out navigating to that mail composer page

i did a test project with following code

- (IBAction)buttonPressed {
    arrRecipients = [[NSMutableArray alloc]init];
    [arrRecipients addObject:@"[email protected]"];


    MFMailComposeViewController *mailController = [[MFMailComposeViewController alloc] init];
    mailController.mailComposeDelegate = self;
    [mailController setSubject:@"Ravikiran test mail"];
    [mailController setToRecipients:arrRecipients];

    [mailController setMessageBody:@"this is my test app" isHTML:YES];
    [self presentModalViewController:mailController animated:YES];
    [mailController release];
}

it is sending mail but it is navigating to mail composer page & then its sending but i need to send mail just on click of the button

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

温馨耳语 2024-11-09 08:39:02

不可以,您无法在没有用户交互的情况下使用 MFMailComposeViewController 发送电子邮件。可能有第 3 方库可以让您执行此操作,但 iOS SDK 不允许您这样做。

此外,您还泄漏了 arrRecipients 数组。

No, you cannot use MFMailComposeViewController to send an email without user interaction. There are probably 3rd parties libraries that let you do this, but the iOS SDK does not allow you to.

Also, you're leaking the arrRecipients array.

时常饿 2024-11-09 08:39:02

满足您需求的最佳方法是拥有一个将数据发送到电子邮件 ID 的 Web 服务。
在发送邮件之前以某种方式通知用户总是好的。

谢谢!

Best way for your needs is to have a web service which sends the data to an email id.
its always to good to inform the user in some way before sending the mail.

Thanks!

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文