Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

smsawant

macrumors newbie
Original poster
May 7, 2009
8
0
i am attaching image in email.but how can we attach html file in email ?
here is code by which i am attaching image file in an email.

Code:
	UIImage *artworkImage = viewImage;
	NSData *artworkJPEGRepresentation = nil;
	if (artworkImage) 
	{
		artworkJPEGRepresentation = UIImageJPEGRepresentation(artworkImage, 0.7);
	}
	if (artworkJPEGRepresentation)
	{
		[composeVC addAttachmentData:artworkJPEGRepresentation mimeType:@"image/jpeg" fileName:@"Image.jpg"];
	}
	[self presentModalViewController:composeVC animated:YES];
	[composeVC release];

How can we attach HTML in a same way.

I don't want to set HTML as body ,i want to send HTML as attachment.

kindly guide me regarding this issue.
 
Convert your HTML to an NSData-class object and then use that for the addAttachmentData: parameter (you'll need to adjust the mimeType as well).
 
Convert your HTML to an NSData-class object and then use that for the addAttachmentData: parameter (you'll need to adjust the mimeType as well).

Code:
NSData* htmlAttach = [NSData dataWithContentsOfFile:filepath];
[composeVC addAttachmentData:htmlAttach
                    mimeType:@"text/html"
                    fileName:@"html-file.html"];

i have tried this but it is not working. it shows HTML as attachment but does not show the output of that attached file.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.