tags:

views:

144

answers:

2

Hello all,

I am using MailComposer available in iPhone sdk3.0.

I am using the following code to add image using html to my email body. It displays the image properly in mail body. But when I try to send it. It breaks leaving message in the log , No image found. Can anyone help me regarding this where am going wrong. Like I also tried attaching the images, but it wasnt working. It does display the images in the composer but breaks while sending.

UIImage *tempImg = [self getSmallImage:[dbPersistenceObj getImage:[[imageIdArray objectAtIndex:i] intValue]]];
NSData *imageData = UIImageJPEGRepresentation(tempImg,1);

NSString *encodedImage = [self base64EncodingWithLineLength:[imageData length] data:imageData]; 

emailBody = [emailBody stringByAppendingFormat:@"<b><img src='data:image/jpg;base64,%@' alt='64 bit image'/></b>", encodedImage];

tnx.

A: 

data: URLs are not supported when sending email. Upload the image to a central server and then link to that using a standard <img src="http://example.com/image.jpg" /> tag

rpetrich
A: 

Just tested with 3.1 - works like a charm!

"data: "URLs are definitely supported in 3.1 when sending email with the MFMailComposeViewController!

Markus
Hey can you give me some detail. Like a snap shot of code to use to insert an image in the mail composer. I have an UIImage which I get from the database and want to insert it in mail composer.
rkb