Iphone MFMailComposer放置感谢,视为附件图像后的文本

Iphone MFMailComposer放置感谢,视为附件图像后的文本,iphone,objective-c,ios,cocoa-touch,mfmailcomposeviewcontroller,Iphone,Objective C,Ios,Cocoa Touch,Mfmailcomposeviewcontroller,您好,我正在使用MFMailComposer在我的应用程序中发送邮件,我在应用程序中附加了一个图像和正文html内容,最后我在邮件中添加了感谢、问候信息,但所有文本内容(包括感谢、问候)都是一组,然后是我的图像附件,然后从我的iPhone签名文本发送过来。 我想在我的iPhone签名文本发送之前放置感谢,问候文本,我如何才能做到这一点?我使用Matt Gallagher的NSData+Base64将图像转换为Base64,因此请在您的项目中添加: 首先创建emailBody,如下所示: NSMu

您好,我正在使用MFMailComposer在我的应用程序中发送邮件,我在应用程序中附加了一个图像和正文html内容,最后我在邮件中添加了感谢、问候信息,但所有文本内容(包括感谢、问候)都是一组,然后是我的图像附件,然后从我的iPhone签名文本发送过来。
我想在我的iPhone签名文本发送之前放置感谢,问候文本,我如何才能做到这一点?

我使用Matt Gallagher的NSData+Base64将图像转换为Base64,因此请在您的项目中添加:

首先创建emailBody,如下所示:

NSMutableString *emailBody = [[NSMutableString alloc] initWithString:@"<html><body>"] ;

[emailBody appendString:@"<p>Check Attachment</p>"];
UIImage *emailImage = [UIImage imageNamed:@"myImageName.png"];
 //Convert the image into data
NSData *imageData = [NSData dataWithData:UIImagePNGRepresentation(emailImage)];
 //Create a base64 string representation of the data using NSData+Base64
NSString *base64String = [imageData base64EncodedString];
 //Add the encoded string to the emailBody string
 //Don't forget the "<b>" tags are required, the "<p>" tags are optional
[emailBody appendString:[NSString stringWithFormat:@"<p><b><img src='data:image/png;base64,%@'></b></p>",base64String]];
 //You could repeat here with more text or images, otherwise
[emailBody appendString:[NSString stringWithFormat:@"<p><b>%@</b></p>",yourString]];// yourString after image here
 //close the HTML formatting
[emailBody appendString:@"</body></html>"];

答案值得称赞。

我使用Matt Gallagher的NSData+Base64将图像转换为Base64,因此在项目中添加:

首先创建emailBody,如下所示:

NSMutableString *emailBody = [[NSMutableString alloc] initWithString:@"<html><body>"] ;

[emailBody appendString:@"<p>Check Attachment</p>"];
UIImage *emailImage = [UIImage imageNamed:@"myImageName.png"];
 //Convert the image into data
NSData *imageData = [NSData dataWithData:UIImagePNGRepresentation(emailImage)];
 //Create a base64 string representation of the data using NSData+Base64
NSString *base64String = [imageData base64EncodedString];
 //Add the encoded string to the emailBody string
 //Don't forget the "<b>" tags are required, the "<p>" tags are optional
[emailBody appendString:[NSString stringWithFormat:@"<p><b><img src='data:image/png;base64,%@'></b></p>",base64String]];
 //You could repeat here with more text or images, otherwise
[emailBody appendString:[NSString stringWithFormat:@"<p><b>%@</b></p>",yourString]];// yourString after image here
 //close the HTML formatting
[emailBody appendString:@"</body></html>"];

答案是值得称赞的。

也分享你的代码。同时分享你的问题屏幕快照如果你有一个显示当前电子邮件顺序的列表,阅读这篇文章会更容易,然后是一个所需电子邮件的列表。也分享你的代码。同时分享你的问题屏幕。如果你有一个显示当前电子邮件顺序的列表,然后是一个所需电子邮件的列表,那么阅读该列表会更容易。