开发者

How to embed images in an email

开发者 https://www.devze.com 2023-01-21 13:13 出处:网络
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 )

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..." />
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号