标签: mfmailcomposeviewcontroller

在mailcomposer中向html主体添加新行

如何将新行字符添加到邮件作曲家的html主体?

我有一个字符串:

NSString *emailBody = [NSString stringWithFormat:@"<html><b>%%0D%%0AHello,%%0D%%0AHere's a link to your product%%0D%%0A<a href=\"%@\">click here</a>%%0D%%0A best regards</b></html>", currentProduct.url_product_details];

[picker setMessageBody:emailBody isHTML:YES];
Run Code Online (Sandbox Code Playgroud)

当我设置邮件编辑器的主体时,我看到它没有新的线条.如何使新线条出现?

TIA

html iphone iphone-sdk-3.0 mfmailcomposeviewcontroller

3
推荐指数
1
解决办法
3834
查看次数

MFMailComposeViewController模型不显示

我在我的电子邮件应用程序中展示了MFMailComposeViewController.但是视图没有显示,只显示上部SEND和CANCEL按钮.

这是在点击"Email to Subscribe"按钮后显示的视图的屏幕截图.

在此输入图像描述

我查看了所有相关代码.我添加了"MessageUI"框架并导入

MessageUI/MessageUI.h , MessageUI/MFMailComposeViewController.h
Run Code Online (Sandbox Code Playgroud)

我使用了以下代码:

 - (void)viewWillAppear:(BOOL)animated {

     [self.view setFrame:CGRectMake(0, 62, 320, 418)];

     [APPDELEGATE.window addSubview:self.view];

     [self.navigationController.navigationBar setHidden:NO];
     self.navigationItem.title=@"Free Subscription";
     [super viewWillAppear:animated]; }


 -(void)viewWillDisappear:(BOOL)animated {
     [self.view removeFromSuperview];
     [super viewWillDisappear:animated]; }



     -(IBAction)btnEmailPressed {
         MFMailComposeViewController* Apicker = [[MFMailComposeViewController alloc] init];
         if (Apicker != nil)
         {

         [Apicker setSubject:@"Free Subscription"];

         [Apicker setMessageBody:@" " isHTML:NO];

         NSArray *toRecipients = [NSArray arrayWithObjects:@"info@xyz.com", nil];
         [Apicker setToRecipients:toRecipients];

         Apicker.mailComposeDelegate = self;

         if([MFMailComposeViewController canSendMail])
         {
             [self presentModalViewController:Apicker animated:YES];
         }
         else
         {

         }
         [Apicker release];
     } }


     -(void)mailComposeController:(MFMailComposeViewController *)controller …
Run Code Online (Sandbox Code Playgroud)

iphone xcode objective-c ios mfmailcomposeviewcontroller

3
推荐指数
1
解决办法
6881
查看次数

Objective C:MFMailComposeViewController 中的粗体消息正文

我有这个代码

NSString *messageBody = [NSString stringWithFormat:@"Name: %@\nCompany/Institution: %@\nAddress: %@\nCity: %@\nCountry: %@\nContact Number: %@\nE-Mail: %@\n \n \n Message: %@", rName.text, rCompany.text, rAddress.text, rCity.text, rCountry.text, rContactNumber.text, rEmail.text, rDescription.text];
    [tempMailCompose setMessageBody:messageBody isHTML:NO];
Run Code Online (Sandbox Code Playgroud)

现在MFMailComposeViewController我要做的是将姓名、地址、城市、国家、联系电话、电子邮件和消息设为粗体。我所做的是插入<strong>,但结果是错误的,它也显示<strong>为文本。

我怎样才能加粗它?

objective-c ios mfmailcomposeviewcontroller

3
推荐指数
1
解决办法
1200
查看次数

将 .mov 附加到 MFMailComposeViewController

我想通过电子邮件发送 .mov 文件。所以我使用 MFMailComposeViewController。花了一些时间搜索后,我终于写了下面的代码。

NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
NSString *documentsDirectory = [paths objectAtIndex:0];
NSString *myPathDocs =  [documentsDirectory stringByAppendingPathComponent:
                                     [NSString stringWithFormat:@"/Saved Video/%@",[player.contentURL lastPathComponent]]];
MFMailComposeViewController *mail = [[MFMailComposeViewController alloc] init];
mail.mailComposeDelegate = self;
[mail addAttachmentData:[NSData dataWithContentsOfURL:[NSURL URLWithString:myPathDocs]] mimeType:@"video/quicktime" fileName:[myPathDocs lastPathComponent]];
[mail setSubject:@"Share VIDEO by My App"];
[self presentViewController:mail animated:YES completion:nil]; 
Run Code Online (Sandbox Code Playgroud)

当邮件编辑器出现时,我可以在邮件正文中看到附件,但我收到的这封邮件没有附件。
我错过了什么吗?或做错了什么?

请帮我。

email objective-c email-attachments ios mfmailcomposeviewcontroller

3
推荐指数
1
解决办法
758
查看次数

MFMailComposeViewController canSendMail 始终返回 false

我正在尝试在我的 iOS 应用程序上使用 MFMailComposeViewController 发送电子邮件。

我在 iPhone 默认邮件应用程序中配置了 Gmail 帐户。但每当我尝试发送电子邮件时,我都会收到MFMailComposeViewController canSendMail错误的消息,因此我的代码无法使用给定的抄送和附件打开邮件应用程序

#import <MessageUI/MessageUI.h>
#import "RNMail.h"
#import <React/RCTConvert.h>
#import <React/RCTLog.h>

@implementation RNMail
{
    NSMutableDictionary *_callbacks;
}

- (instancetype)init
{
    if ((self = [super init])) {
        _callbacks = [[NSMutableDictionary alloc] init];
    }
    return self;
}

- (dispatch_queue_t)methodQueue
{
    return dispatch_get_main_queue();
}

+ (BOOL)requiresMainQueueSetup
{
    return YES;
}

RCT_EXPORT_MODULE()

RCT_EXPORT_METHOD(mail:(NSDictionary *)options
                  callback: (RCTResponseSenderBlock)callback)
{
    if ([MFMailComposeViewController canSendMail])
    {
        MFMailComposeViewController *mail = [[MFMailComposeViewController alloc] init];
        mail.mailComposeDelegate = self;
        _callbacks[RCTKeyForInstance(mail)] = callback;

        if …
Run Code Online (Sandbox Code Playgroud)

iphone objective-c ios mfmailcomposeviewcontroller ios12

3
推荐指数
1
解决办法
3964
查看次数

如何在不打开邮件编辑器 iOS swift 的情况下发送电子邮件?

我正在做 iOS swift 项目。我想用应用程序本身发送邮件。当用户单击应用程序内的提交按钮时,邮件需要在后台发送,否则弹出窗口将出现在应用程序内,而无需导航到邮件编辑器。

\n
        if MFMailComposeViewController.canSendMail() {\n            let mail = MFMailComposeViewController()\n            mail.mailComposeDelegate = self\n            mail.setToRecipients([ApplicationModel.sharedInstance.mailAddress])\n            mail.setSubject("Feedback: \\(UserDefaults.Id)")\n            mail.setMessageBody(sendBpodyMessage(), isHTML: false)\n            present(mail, animated: true)\n        } else {\n            if let emailUrl = createEmailUrl(to: ApplicationModel.sharedInstance.mailAddress,\n                                             subject: "Feedback", body: sendBpodyMessage()) {\n                UIApplication.shared.open(emailUrl)\n            }\n        }\n
Run Code Online (Sandbox Code Playgroud)\n

我参考了很多答案,所有人都说没有办法,苹果没有这个功能。有可能吗,或者还有其他方法吗?

\n

大多数人说使用API​​发送到自己的服务器。如果我没有\xe2\x80\x99t 有任何与上述问题相关的选项,我会尝试一下。

\n

email ios swift mfmailcomposeviewcontroller

3
推荐指数
1
解决办法
1755
查看次数

MFMailComposeViewController挂起我的应用程序

我正在尝试向我的应用添加电子邮件功能.我可以让MFMailComposeViewController正确显示并预先填充其主题和正文,但由于某些原因,当用户点击导航栏中的"取消"或"发送"按钮时,应用程序就会挂起.我在第一行插入了一个NSLog()语句mailComposeController"didFinishWithResult:error,它甚至没有将该行打印到控制台.

有没有人知道什么会导致MFMailComposeViewController像这样挂起?

这是标题中的代码:

#import "ManagedObjectEditor.h"
#import <MessageUI/MessageUI.h>

@interface MyManagedObjectEditor : ManagedObjectEditor 
    <MFMailComposeViewControllerDelegate, UIImagePickerControllerDelegate,
     UINavigationControllerDelegate> {
}

- (IBAction)emailObject;
@end
Run Code Online (Sandbox Code Playgroud)

来自实施文件:

if ([MFMailComposeViewController canSendMail]) {        
    MFMailComposeViewController *mailComposer = [[MFMailComposeViewController alloc] init];
    mailComposer.delegate = self;
    [mailComposer setSubject:NSLocalizedString(@"An email from me",
                                               @"An email from me")];
    [mailComposer setMessageBody:emailString
                          isHTML:YES];
    [self presentModalViewController:mailComposer animated:YES];
    [mailComposer release];
}
[error release];
[emailString release];
Run Code Online (Sandbox Code Playgroud)

这是来自回调的代码:

#pragma mark -
#pragma mark Mail Compose Delegate Methods
- (void)mailComposeController:(MFMailComposeViewController *)controller 
          didFinishWithResult:(MFMailComposeResult)result 
                        error:(NSError *)error {
    NSLog(@"in didFinishWithResult:");
    switch (result) {
        case …
Run Code Online (Sandbox Code Playgroud)

iphone mfmailcomposeviewcontroller

2
推荐指数
1
解决办法
3003
查看次数

iOs将我的当前屏幕添加到电子邮件中

我正在绘制一个绘图应用程序,我必须通过电子邮件发送当前绘图.我设法得到当前屏幕的屏幕截图.但是我如何通过MFMailComposeViewControll电子邮件发送图像?这是我用来获取屏幕截图的代码

    UIGraphicsBeginImageContext(self.view.bounds.size);
    [self.view.layer renderInContext:UIGraphicsGetCurrentContext()];
    UIImage *currentScreen = UIGraphicsGetImageFromCurrentImageContext();
    UIGraphicsEndImageContext();
Run Code Online (Sandbox Code Playgroud)

iphone ios xcode4.2 mfmailcomposeviewcontroller

2
推荐指数
1
解决办法
328
查看次数

MFMailComposeViewController不会被忽略

按照向我展示如何实现应用程序内邮件的教程后,取消按钮和发送按钮似乎无法关闭视图.

现在我在这里读了一些评论,说我应该实现这个方法:

-(void)mailComposeController:(MFMailComposeViewController*)controller didFinishWithResult:(MFMailComposeResult)result error:(NSError*)error {
[self dismissModalViewControllerAnimated:YES];
}
Run Code Online (Sandbox Code Playgroud)

但这并没有解决问题,不是在模拟器或我的iPhone 4上 - 消息确实发送,但视图不会消失.

到目前为止这是我的代码:

#pragma mark - InApp Mail
- (IBAction)openMail:(id)sender
{
if ([MFMailComposeViewController canSendMail])
{
    MFMailComposeViewController *mailer = [[MFMailComposeViewController alloc] init];


    [mailer setSubject:@"iOS School - MultipleAlertViews"];

    NSArray *toRecipients = [NSArray arrayWithObjects:@"", nil];
    [mailer setToRecipients:toRecipients];

    // Attach an image to the email
    NSString *pathFile01 = @"http://dl.dropbox.com/u/61711378/iOS%20School%20-%20Docs/MultipleAlertViewsVCh.pdf";
    NSURL *pdfURLFile01 = [NSURL URLWithString:pathFile01];
    NSData *pdfDataFile01 = [NSData dataWithContentsOfURL:pdfURLFile01];
    [mailer addAttachmentData:pdfDataFile01 mimeType:@"application/pdf" fileName:@"MultipleAlertViewsVCh.pdf"];

    NSString *pathFile02 = @"http://dl.dropbox.com/u/61711378/iOS%20School%20-%20Docs/MultipleAlertViewsVCm.pdf";
    NSURL *pdfURLFile02 = [NSURL URLWithString:pathFile02];
    NSData …
Run Code Online (Sandbox Code Playgroud)

dismiss ios mfmailcomposeviewcontroller

2
推荐指数
1
解决办法
3633
查看次数

更改MFMailComposeViewController navigationBar标题字体

我有一个MFMailComposeViewController,当我设置主题时,它也将它设置为主题.问题是如何自定义标题和颜色的字体?

MFMailComposeViewController *picker = [[MFMailComposeViewController alloc] init];
[picker setSubject:@"Feedback for MyApp"];
Run Code Online (Sandbox Code Playgroud)

iphone objective-c ipad ios mfmailcomposeviewcontroller

2
推荐指数
1
解决办法
6366
查看次数