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

paos

macrumors newbie
Original poster
Aug 13, 2009
15
0
I want to send a mail with HTML in it, I'm using somethiong like this:

Code:
NSString *mailRecipeData;
mailRecipeData = [NSString stringWithFormat: @"<table><tr><td style='text-align:left'><b>Title</b>:</td></tr></table>"] ;
NSString *encodedMailRecipeData = [mailRecipeData stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding]; 
NSString *urlString = [NSString stringWithFormat:@"mailto:?subject=%@&body=%@", [@"test"  stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding], encodedMailRecipeData];
NSURL *url = [[NSURL alloc] initWithString:urlString];
[[NSWorkspace sharedWorkspace] openURL:url];
[urlString release];

but for some reason when Mail application opens the body of the mail it's just plain text, can somebody help me?

thanks!
 
Is there some way to do this with applescript? can somebody help me please?
I'm newbie on applescript, any guide will be useful . Thanks!
 
What exactly are you trying to do?

Have some experience in AppleScripting Mail. What exactly do you want to send and I can have a quick look at it.
 
thank you robbietherobot :), well, what I'm trying to do is to send a custom email from an application with 2 links depending on the users choice, actually I do this on an iPhone app using the code above, but it doesn't work for mac apps, so I'm trying to do it using applescript, any help will be very appreciated .
 
Simple Applescript for sending mail...

The following should make a new mail. Uncomment out the last "send" line to send off.

You should be able to pass what you need into your variables?

The links should get parsed at the other end and then be clickable?

Hope this helps. Don't understand any of that NSString stuff! Yet!...

--Variables
set vSubject to "Subject Line"
set vEmailAddress to "sample@test.com"
set vLink1 to "http://www.apple.com"
set vLink2 to "http://www.apple.com/store"

tell application "Mail"

set theMessage to make new outgoing message with properties {visible:true, subject:"" & vSubject & "", content:"Body here." & return & return & vLink1 & return & return & vLink2}

tell theMessage to make new to recipient with properties {address:vEmailAddress}

--send theMessage

end tell
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.