我希望能够在我的应用程序中使用iPhone Mail.app,这样我的用户就可以在不离开应用程序的情况下发送共享电子邮件.我知道3.0使这成为可能.
我通过ctrl单击我的框架文件夹 - >添加现有框架来正确添加框架.
将此添加到我希望Mail.app出现的viewcontroller的头文件中.
#import <MessageUI/MessageUI.h>
Run Code Online (Sandbox Code Playgroud)
我弹出一个UIAlert,在关闭时我调用下面的函数,我的代码中没有出现错误.我是否必须在Interface Builder中做一些额外的事情?错误消息是在下面
-(void)showEmailModalView {
MFMailComposeViewController *picker = [[MFMailComposeViewController alloc] init];
picker.mailComposeDelegate = self; // <- very important step if you want feedbacks on what the user did with your email sheet
NSString * emailSubject = [[NSString alloc] initWithFormat:@"iPhone Subject Test"];
[picker setSubject:emailSubject];
NSString * content = [[NSString alloc] initWithFormat:@"iPhone Email Content"];
// Fill out the email body text
NSString *pageLink = @"http://mugunthkumar.com/mygreatapp"; // replace it with yours
NSString *iTunesLink = @"http://link-to-mygreatapp"; // …Run Code Online (Sandbox Code Playgroud) email iphone frameworks uiviewcontroller mfmailcomposeviewcontroller
我有以下代码在didSelectRowAtIndexPath中调用.问题是,当我单击取消按钮时,它会提示保存草稿或丢弃.但是当我点击其中任何一个时,视图都不会被忽略.我在之前的iOS 5应用程序中使用了相同的代码并且它被解雇了.有任何想法吗?我在界面中有MFMailComposeViewController委托协议.
if (indexPath.row == 0)
{
if([MFMailComposeViewController canSendMail])
{
MFMailComposeViewController *picker = [[MFMailComposeViewController alloc] init];
picker.mailComposeDelegate = self;
[picker setSubject:@"Support"];
NSArray *toRecipients = [NSArray arrayWithObject:@"contact@app.com"];
[picker setToRecipients:toRecipients];
NSString *emailBody = text;
[picker setMessageBody:emailBody isHTML:NO];
[self presentModalViewController:picker animated:YES];
}
}
Run Code Online (Sandbox Code Playgroud) 在我的应用程序中,我正在截取图像View的截图,然后我将这些屏幕截图保存在应用程序的文档文件夹中.现在我想通过电子邮件发送所有这些图像,它们具有相同的文件夹结构.压缩包含图像的所有文件夹然后将zip文件附加到邮件将解决问题,但我如何压缩这些文件夹,然后将它们附加到邮件?
任何帮助表示赞赏!
我正在尝试收到我选择发送电子邮件的电子邮件.但我不知道如何setToRecipients我在MFMailComposeViewController视图中选择的用户.
if ([MFMailComposeViewController canSendMail])
{
mailer = [[MFMailComposeViewController alloc] init];
mailer.mailComposeDelegate = self;
[mailer setSubject:@"A Message from blablabl"];
NSMutableArray *usersTo = [[NSMutableArray alloc] init];
toRecipients = usersTo;
[mailer setToRecipients:toRecipients];
NSString *emailBody = @"blablablabal";
[mailer setMessageBody:emailBody isHTML:YES];
// only for iPad
// mailer.modalPresentationStyle = UIModalPresentationPageSheet;
[self presentModalViewController:mailer animated:YES];
}
else
{
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Failure"
message:@"Your device doesn't support the composer sheet"
delegate:nil
cancelButtonTitle:@"OK"
otherButtonTitles: nil];
[alert show];
}
Run Code Online (Sandbox Code Playgroud)
我通过MFMailComposeViewController发送csv附件时遇到问题.有时它们会很好地通过,但对于其他用户来说,它们不是作为附件而来的,而是作为电子邮件中的文本内联(而不是行返回).这很奇怪.谁知道我做错了什么?这是我的代码片段:
MFMailComposeViewController *mailComposeViewController = [[MFMailComposeViewController alloc] init];
mailComposeViewController.mailComposeDelegate = self;
NSString *csv = @"foo,bar,blah,hello";
NSData *csvData = [csv dataUsingEncoding:NSUTF8StringEncoding];
[mailComposeViewController addAttachmentData:csvData mimeType:@"text/csv" fileName:@"testing.csv"];
[mailComposeViewController setSubject:@"testing sending csv attachment"];
[mailComposeViewController setMessageBody:@"csv file should be attached" isHTML:NO];
[self presentModalViewController:mailComposeViewController animated:YES];
Run Code Online (Sandbox Code Playgroud) 我需要在MFMailComposeViewController中设置邮件Body以分隔一些行中的文本.我使用以下代码行但它无法正常工作.
[mail setMessageBody:[NSString stringWithFormat:@"Hi I am Interested to buy a vehicle for me Name :%@ %@ \n Contact No. : %@ \n Email : %@\n",txtFirst.text, txtLast.text, txtContact.text, txtEmail.text ] isHTML:YES];
Run Code Online (Sandbox Code Playgroud)
我也尝试过这个
[mail setMessageBody:[NSString stringWithFormat:@"Hi I am Interested to buy a vehicle for me Name :%@ %@ </br> Contact No. : %@ </br> Email : %@</br>",txtFirst.text, txtLast.text, txtContact.text, txtEmail.text ] isHTML:YES];
Run Code Online (Sandbox Code Playgroud)
有什么办法可以做到这一点.
我是一名软件开发人员,我正在为电子邮件制作应用程序,我有以下代码:
// Header file
// importing the MessageUI framework
#import <MessageUI/MessageUI.h>
// adding the delegate functionality to the class (<MFMailComposeViewControllerDelegate>)
@interface TutorialProjectViewController : UIViewController <MFMailComposeViewControllerDelegate> {
}
- (IBAction)pressTheMailButtonDudeFunction:(id)sender
// Implementation file
- (IBAction)pressTheMailButtonDudeFunction:(id)sender {
// allocatind new message composer window
MFMailComposeViewController *mc = [[MFMailComposeViewController alloc] init];
// setting a delegate method to "self"
mc.mailComposeDelegate = self;
// pre-populating the message subject
[mc setSubject:@"Send me a message"];
// adding content of the message as a plain text
[mc setMessageBody:@"Send me …Run Code Online (Sandbox Code Playgroud) iphone objective-c messageui ipad mfmailcomposeviewcontroller
我想从我的自定义iPhone应用程序发送邮件.我曾经MFMailComposeViewController在我以前的应用程序中从我的iphone发送邮件.现在,我不想向MFMailComposeViewController用户显示,如果他们点击Send Mail button邮件自动发送给recipient mail address.我怎样才能做到这一点?你能帮帮我吗?提前致谢.
我用下面的代码来显示MFMailComposeViewController,
MFMailComposeViewController *controller = [[MFMailComposeViewController alloc] init];
controller.mailComposeDelegate = self;
[controller setSubject:@"Details"];
[controller setMessageBody:@"Hi" isHTML:NO];
[controller setToRecipients:[NSArray arrayWithObjects:@"abcd.m@gmail.com", nil]];
[self presentModalViewController:controller animated:YES];
[controller release];
Run Code Online (Sandbox Code Playgroud) 我正在尝试将图像包含在从iPad发送的HTML电子邮件的正文中.这似乎不可能.我曾尝试使用CID方法,但似乎在iOS中无法获取/设置附件的CID.
我也尝试用图像嵌入图像src="data:image/png;base64, blahblahblah".撰写邮件时,它似乎有效,但收到邮件时没有任何内容.
有任何想法吗?
更多细节:我们不是在寻找在电子邮件底部附加JPEG/PNG的解决方案.这很容易做到[composer addAttachmentData:mimeType:fileName:].
我们正在寻找在图像嵌入解决方案内嵌在HTML格式的电子邮件.您可以围绕该IMG标记包裹一个链接,这样当收件人点击IMG时,他/她将被链接到应用程序的iTunes页面.
html email email-attachments ios mfmailcomposeviewcontroller
iOS在MFMailComposeViewController中为所有彩色文本使用标准(蓝色)色调颜色.这对我来说并不好,因为客户希望他的公司颜色在应用程序中.如何将颜色改为橙色?
我特别询问按钮图标(添加图像和铃声图像)的颜色和包含邮件地址的文本.我已经改变了导航栏的颜色.在文档中,有写:
此类的视图层次结构是私有的,您不能修改它.但是,您可以使用UIAppearance协议自定义实例的外观.
我试图使用它,但它不起作用(我可能做错了,因为我不知道UIAppearance).这是我尝试过的:
[[UIButton appearanceWhenContainedIn:[MFMailComposeViewController class], nil] setTitleColor:[UIColor orangeColor] forState:UIControlStateNormal];
[[UILabel appearanceWhenContainedIn:[MFMailComposeViewController class], nil] setTextColor:[UIColor orangeColor]];
Run Code Online (Sandbox Code Playgroud)

mfmailcomposeviewcontroller ×10
iphone ×7
objective-c ×6
email ×2
ios ×2
ipad ×2
attachment ×1
cocoa-touch ×1
csv ×1
frameworks ×1
html ×1
inline ×1
messageui ×1
sendmail ×1
uiappearance ×1
xcode ×1
zip ×1