Applescript for sending selection as new Mail

Hello. What i'm trying to achieve is adding an option to Safari for getting the selected text and sending it to Mail as the content of a new email message, along with the website's url. The already available action "New Mail Message" is able to do half of what i'm asking: it can send my selection to Mail as the content of a new emal message, but nothing more. I'm trying to compose an Applescript to run from within my Automator Service, but i'm getting an error: *The action "Run AppleScript" encountered an error.*
Any ideas?
Here is a screenshot of my Automator Workflow:
http://tinypic.com/r/2qi2xom/3
*And here is the script i'm using:*
on run {input, parameters}
set myBodyText to value of variable "mySelection" of front workflow
set siteURL to value of variable "mySiteURL" of front workflow
tell application "Mail"
make new outgoing message with properties {visible:true, subject:"Something Interesting", content:"" & siteURL & myBodyText}
end tell
return input
end run

Javascript can return the selected text...
tell application "Safari"
tell document 1
set selected_text to do JavaScript "var txt = '';
if (window.getSelection)
    txt = window.getSelection();
else if (document.getSelection)
    txt = document.getSelection();
else if (document.selection)
    txt = document.selection.createRange().text;
else return;
set siteURL to URL
end tell
end tell
tell application "Mail"
activate
make new outgoing message with properties {visible:true, subject:"Something Interesting", content:"" & siteURL & return & return & selected_text}
end tell

Similar Messages

  • Send button on "new" mail missing.

    The SEND button on the new mail being composed has gone missing. I checked on the same MACOSX version of my Powerbook and it's still there. Anyone have any idea what's happened.
    Thanks,
    Bette

    Thanks. My Send button is now back. It took me a while to understand what and exactly where the lozenge shaped button is, Finally found it under the upper right magnifying glass -- the oblong shaped untitled button. Duh! BTW, love the upper right magnifying glass to search my computer.
    Thanks for solving this headache.
    I had a difficult time getting my outgoing SMTP server for BellSouth (AT&T) set up for Mail 3.1. Has to be exactly right and ATT only has on line instructions up to 2.1. Changing outgoing server took two saves -- first time entered new server, stayed at "none" and had to go back in to select.
    Off and running with my new and first mac. Yay! Though very disappointed to have to run Quicken 2008 for PC on Boot Camp given the problems with Q 2007 for mac. Pages and pages of instructions to port and still lots of warnings about possible problems with Mac version. Also off to google how to surf and download while in Boot Camp so I can download to Quicken.

  • TS3276 cannot send open a new mail window. hear a small beep

    it will not let me open a new mail screen. The mail is working (all green dots) I just hear a faint beep.....please help!

    Launch the Console application in any of the following ways:
    ☞ Enter the first few letters of its name into a Spotlight search. Select it in the results (it should be at the top.)
    ☞ In the Finder, select Go ▹ Utilities from the menu bar, or press the key combination shift-command-U. The application is in the folder that opens.
    ☞ If you’re running Mac OS X 10.7 or later, open LaunchPad. Click Utilities, then Console in the page that opens.
    Click the Clear Display icon in the toolbar. Try the action again. Post any messages that appear in the Console window – the text, please, not a screenshot.
    Important: Some private information, such as your name, may appear in the log. Edit it out by search-and-replace in a text editor before posting.

  • Default settings for sending smart forms via mail saving it in pdf

    do we have to do any default settings in any trasaction code like scot for solving the above problem

    hi  thanku very much durga prasad
    my mail id is [email protected]

  • SOund for sent or received new mail

    Many times the sound of the mail disappears and cannot hear if at max volume, is that an error or how to rectify it ?

    I have this problem, too. Mail sounds disappear. They return if I quit Mail, then immediately open it, or if I reboot. What is the fix/ Is this a software problem? Do I need to reinstall tiger?

  • Can Reply, but Can't Send New Mail

    I first noticed this when I tried to share a URL last night. I kept getting an error trying to send the URL. I've tried sending test mail and there's no immediate error, but the messages show up in the out box, indicating unsent.
    However, if I reply to mail, it sends without a problem. This is all to and from Earthlink. If I send from .Mac, new mail sends without a problem and then I see the error from trying to send the mail from Earthlink.
    Please help!
    Phredd

    I don't know how the server would block messages any
    differently than it would for messages sent from my
    Mac. They're both going through the same network -
    my Earthlink (Comcast) broadband connection from home.
    If the iPhone and the Mac are using the same network connection, the server shouldn't be able to tell the difference. This tells me your iPhone may be connecting through EDGE and not WiFi.

  • ECC 6.0 with baseline - send PO via e-mail

    Hi forum experts,
    We are having some problems with configuring our system to send POs via e-mail. We are trying to use the following setting, but when the PO is saved (and triggers an output) an error appears without any items in processing log. No e-mail is queued in SOST.
    Medium: 5 - external send
    Program: YBAA_FM06P.
    FORM routine: ENTRY_NEU
    Form: <blank>
    PDF/Smartform form: YBAA_MMPO
    When performing a normal "Print output, medium 1", the PO is successfully printed.
    When changing the program to SAPFM06P, a sapscript form is successfully genereated and queued as an e-mail. We simply don't get it to work using program YBAA_MMPO.
    Are we using the correct program? I have read som discussion threads about it and some experts have suggested to use program /SMB40/FM06P instead. That does not work either.
    Best regards and thanks in advance for your help!
    Magnus

    Hi,
    You are using PDF/Smartform form: YBAA_MMPO for  your PO output and to send mail.
    Use t.code:NACE,select application EF.
    1.Now for your Output type, keep Replacement of text symbols give programm as SAPMM06E and Form Routine as TEXT_SYMBOL_REPLACE in General data  TAB.
    2. Keep Communication Method as CS01
    3. Keep entry of medium as 5 and function as VN
    4.For subject of the mail goto Mail Title and Texts give PO No. &EKKO-EBELN& .
    5.Keep condition record with your PO output type and have medium 5 with function VN
    6. For sending PO by e-mail- you should an e-mail ID in your vendor master
    Regards,
    Biju K

  • Always use default email ID for sending

    I have several accounts. I want my main ID to be used when send out a new mail, unless I change it manually. Presently, a new mail takes on the ID of the message in the inbox that is highlighted. How can I set this?

    Mail Preferences/Composing and choose the preferred address beside "Send new mail from:" should take of it.
    Ernie

  • A silver dollar for anyone who can explain Mail 'Get Messages' failure

    Mail 6.2 (build 1499) on a very stable 10.8.2.
    No settings changed in the last 6 months; no accounts added (etc) in the last 30 days; same ISP (Time Warner - have reset my cable modem etc).
    Until a couple of days or so ago, Get Mail (top left) took at most 5 seconds to retrieve all POP3 mail from the dozen or so accounts I have with three or four hosts.
    Now, every time I try to collect from all my accounts that way, one or more of them fails.
    Every tme. Different accounts, which means different of the hosts.
    Right-clicking on the single account(s) with the triangle exclamation point and selecting 'Get new mail from…' immediately afterwards invariably works instantly.
    What can it be about the act of collecting all mail that fails when from individual accounts/separate hosts one at a time it succeeds?
    Thanks!

    Try a reset first: hold down the home button along with the power button until you see the Apple, then let go.

  • New Mail Icon notification

    Normally when a new email arrives in my inbox i receive a notification ( red bubble on the mail icon in my doc bar and a notification icon in the folder that my new mail has arrived into )
    For some strange reason i am no longer receiving any notifications for my inbox. New mail arrives but i don't get informed of it (doesn't show up in the icons).
    I've tried removing the plists from the user library settings and have also tried removing the IMAP account and adding it again.
    neither solution has helped and i'm wondering if anyone has had a similar problem and found a work around.
    I've also tried rebuilding the mailbox, which hasn't worked.
    i've run all the software updates an am using 10.5.7.
    any help would be much appreciated!

    I've got the same problem.
    any help?

  • Mac Mail sending out multiple e-mails

    Dear All,
    My friend reports that today he is receiving 3 copies of every e-mail message that I send him.  I'm working on a Mac Pro, Lion 10.7.5, using Mac Mail through Yahoo, and I have only one account.  I have an iPod touch, but I have never sent e-mail through that device nor signed up for it on the iPod -- I only use my Mac desktop for sending and receiving e-mails.  Anyone else having this recent problem?  I never had it before today!  Thanks.

    Are you sure it's the Mac sending out the spam, or just spam masquerading as coming from your email account (the From: line is ridiculously simple to forge)?
    While it's clearly possible to devise a system to cause a Mac to send out spam email (or any other computer for that matter), it wouldn't be terribly efficient for the spammer.  Even when they take over zombie machines (and unpatched Windows XP systems are the favorites there) the spammer would prefer to use the machine to send out all kinds of email *AND* would attempt not to draw attention to the actual machine sending out the stuff.
    That is, where it *appears* to be coming from will generally not be where it is coming from. 
    What malware prefers to do is "harvest" an address book from a user's computer (or, more often these days, from an online address book after phishing the credentials from the user) and then using that to send out emails to your contacts that look like they come from you so that they are more likely to be opened.  If that's what has happened, there's nothing you could do to the Mac at this point to get that data back. 
    Again, while it is clearly possible to harvest that data under either OSX or Windows 7 from your address book in either platform, it is considerably more difficult to do that than to go after your credentials for an online site using a phishing attack and then make use of the contact information.

  • Action profile for send email to multiple partners

    Hi
    i need to send Smartforms mail using action profile to all partners assigned in the partners tab.
    Is there some standard way of doing it other than creating partner dependent  action profile for each partner?
    Thanks
    Itty

    hi Itty,
    based on my knowledge and experience, there is 2 ways for sending a smartforms via mail in action, ie :
    1. using smartforms mail
    2. using method.
    for option 1, only can be send to one target only. therefore usually i used the option 2.
    in option 2 basically you create an implementation class from defenition class EXEC_METHODCALL_PPF.
    the implementation class basically just a program, so in this implementation class you can get all the partners in the partners tab using function modul CRM_ORDER_READ and get all recipient mail, generate the smartforms and send it as attachment to all mail target.
    hopes it helps
    cheers

  • Mavericks Gmail account - new mail showing up in Archive but not in Inbox

    For a Gmail account, new mail seems to be showing up in the "Archive" folder for that account (which seems to be mapped to Gmail's "All Mail").
    However it isn't showing up in the Inbox for the account.
    The settings seem identical to another Gmail account where mail is showing up in the Inbox.
    Any thoughts of what I might do to get these mails to show up in the Inbox?
    Thanks,
    Doug

    I don't know. I've given up for now and am using Mailplane. I will be doing a write-up on it, but it seems to be working much better than Airmail even.
    The funny thing about using Mailplane, which is a lot more directly connected to Gmail than any of the other clients, is that for the first time I'm seeing that even the iOS Mail app, which I thought had no problems, is actually lagging quite a lot behind the actual Gmail contents!
    I think Mail.app is hopeless at this point. Maybe it's good if you want to transfer an an entire IMAP set of folders between accounts if you are migrating (as is Thunderbird). But basically it's become extremely unreliable under Mavericks. I can't believe Apple let it out of the door.
    doug

  • IPhone (iOS 5) doesn't play New Mail tone

    iPhone 4, iOS 5
    For some reason, the New Mail tone has stopped working on the phone. It works on the iPad (1) with iOS5.
    Didn't change anything, it seems to have just stopped.
    I've tried (1) restoring the phone as a "new phone", (2) resetting the phone, etc. etc.
    The setting is in Settings > Sounds > New Mail > Bell
    doesn't matter what it's on, it doesn't work.
    I'm at a loss.
    Paul

    iOS 5 should have compatibility with docking stations... you may try doing a restore, or, as a last resort getting a replacement.

  • All new mail is flagged??

    This problem may be linked to my Blackberry, but for some reason all new mail coming from my Gmail account to mail is flagged... any suggestions? I have Blackberry push email btw

    Solved my own problem!

Maybe you are looking for

  • Frequent 30 second spinning cursor in MacBook with 2GB RAM?

    I currently use a G5 dual processor desktop and a laptop daily. I just switched from a MacBook Pro to a MacBook with 2 GB of RAM. All of them have identical configurations that were copied from one machine to another over Firewire at install time. Af

  • Help needed in 8i Lite Replication Programming

    Hi: I am currently doing a prototype of using Oracle Lite 8i replication service. I am using the Oracle Replication OLE Control (shipped with 8i Lite) in a VB program. I just tried to connect to my local 8i Lite database by using the API, here is the

  • What are the consequences of not backing up controlfile in hot backup.

    Hi All, We have 8i,9i, 10g and 11g database. The unfortunate thing is that we are using this user managed hot backups for backing up our database. and I have no idea for what reason, we are not backing up the controlfile. Anyway, I would like you to

  • Service Entry Sheet IDOC

    Hi, Is there an IDOC available for Service entry sheets. Like in our case we want to generate an IDOC when a service entry sheet is created in the system and send it to a third party application. Thanks.

  • Unlocked iPhones bought in US, function with foreign operator?

    Hi, If I buy an unlocked iPhone in the US, will I be able to use it with my european operator in Europe? I know in the pas there were some issues with it but from what I understand it has now been resolved. I prefere to ask as the unlocked phones are