How to embed images in an email
I have an in-app mail composer. I would like to add an image at the bottom of the email body with a http link wrapped around it (usual business )
The image is in my resources. My goal is to add the image and have link the image to the app store.
How 开发者_运维百科do I do that?
That's how I am attaching the image right now:
NSString *path = [[NSBundle mainBundle] pathForResource:@"appIcon" ofType:@"png"];
NSData *myData = [NSData dataWithContentsOfFile:path];
[picker addAttachmentData:myData mimeType:@"image/png" fileName:@"appIcon"];
I would suggest encoding image with base64 Example, and using with HTML mail body. It is less painful, and more practical.
<img alt="Embedded Image"
src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADIA..." />
精彩评论