• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Mail slow creating html message
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Mail slow creating html message


  • Subject: Mail slow creating html message
  • From: email@hidden
  • Date: Sun, 01 Dec 2013 12:35:03 +1300

Hello. Not sure if this the right list.

I have an app where the user can mail results to another.

I am using applescript to create an HTML content message.

The problem is, it takes Mail 10-15secs to create the message. And it does not have it's own window.

if "<--------- this line" is removed, the message creation is instantaneous.

Anyone have any idea?

The app is sandboxed. (Doesn't seem to make a difference).

//----------------------------------------------------------------------------

#define EMAIL_TEMPLATE "<HTML>\

<BODY bgcolor=WHITE> \

<H2>Dice Rolls</H2> \

<p>Some results = RES</p>\

</BODY> \

</HTML> \

"

//-----------------------------------------------------------------------------

NSAppleScript *mailScript=nil;

NSString* subject=@"Die Rolls for the Traveller Die Roll Maker";

NSString* body=self.lineRangeBevel.integerValue == 0 ? self.lineText.stringValue : self.rangeTextView.string;

NSString* htmlbody=@EMAIL_TEMPLATE;

NSString* toWho=self.email.stringValue;

NSString *scriptString=nil; 

scriptString=[NSString stringWithFormat:@"\

set textBody to \"%@\"\n\

tell application \"Mail\"\n\

set newMessage to make new outgoing message with properties {subject:\"%@\", content:\"%@\" & return} \n\

tell newMessage\n\

set html content to textBody\n\     <--------- this line

set visible to true\n\

set sender to \"%@\"\n\

make new to recipient with properties {address:\"%@\"}\n\

end tell\n\

activate\n\

end tell\n",

htmlbody, subject, body, @"Traveller Dice Roller", toWho];

// name:\"%@\",  b ? @"Traveller Dice" : @"", 

mailScript = [[NSAppleScript alloc] initWithSource:scriptString];

NSDictionary* e=nil;

[mailScript executeAndReturnError:&e];

 

------------------------------------------

TIA

Mark

 
 _______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users

This email sent to email@hidden

  • Prev by Date: Re: System Events -600 error
  • Previous by thread: Re: System Events -600 error
  • Index(es):
    • Date
    • Thread