-2

i am trying to send an html page which includes image and text. The problem is that image in not shown when i send it. what could be the solution for it ? thaks in advance..

My code is :

[picker addAttachmentData:myData mimeType:@"pdf" fileName:@"ShowerDoorsQuotation.pdf"];
NSString *emailBody = [NSString stringWithFormat:@"<html>
  <head>
  </head>
  <body><img  src='ShowerDoors/ShowerDoors/logo.png' width='150px' height='150px'/>
  </body>
  </html>"];

[picker setMessageBody:emailBody isHTML:YES];
[self presentModalViewController:picker animated:YES];
[picker release];
Rohan
  • 2,939
  • 5
  • 36
  • 65

3 Answers3

1

Currently, You can not send local images using MEMailComposer. Hope apple will include this feature in future.

Rather you can give link of image which are on your server. And then you will able to see images in mail.

Or as paulheyer writes in his answer:

You can have inline images in HTML but you have to encode the attachments data using base64 encoding. This leads to problems with some email clients e.g. Gmail. Please find a detailed discussion on this issue here: How to add an UIImage in MailComposer Sheet of MFMailComposeViewController in iPhone

Or

How to embed image in html in MFMailComposeViewController for iPhone

Community
  • 1
  • 1
Devang
  • 11,258
  • 13
  • 62
  • 100
  • Do not plagiarize language from other people's answers without providing proper attribution. I've edited your answer to credit paulheyer for the words of his you copied. – Brad Larson Feb 15 '12 at 18:43
1

I think you are put the image URL like this src='ShowerDoors/ShowerDoors/logo.png' Change to the FULL URL like http://www.example.com/ShowerDoors/ShowerDoors/logo.png, It may be works...

Arun Krishnan
  • 1,898
  • 3
  • 16
  • 28
0

If you really need to send html in email you must include absolute urls, not relative.

drunknbass
  • 1,662
  • 1
  • 13
  • 19