Send email from clipboard without opening Thunderbird - email

I asked a question called Send email from clipboard without opening mail.app
Now, I can do this using
set a to "post+UPReuNmbK7pR+414760#checkvist.com"
tell application "Mail"
tell (make new outgoing message)
set subject to (the clipboard)
set content to ""
make new to recipient at end of to recipients with properties {address:a}
send
end tell
end tell
I want to do the same in windows 7, preferably using AHK and Mozilla Thunderbird, since I already have these programs installed. I cannot, however, write this due to my poor programming skills.

I found the answer on lifehacker, here http://lifehacker.com/355941/quickly-compose-new-gmail-messages-with-launchy

Related

Forwarding all iMessages to email using AppleScript

I'm new to AppleScript but learned a bit from searching online. Basically I would like to forward iMessage messages to an e-mail address. I did this with the following script:
using terms from application "Messages"
on message received theMessage from theBuddy for theChat
tell application "Mail"
set theNewMessage to make new outgoing message with properties {subject:"thesubject", content:theMessage, visible:true}
tell theNewMessage
make new to recipient at end of to recipients with properties {address:"myemail#gmail.com"}
send
end tell
end tell
end message received
end using terms from
Works great and it puts the iMessage in the content of an e-mail that gets sent to me.
Now I'm trying to do this with attachments as well. I modified the code to give me 4 beeps when a file is received but nothing happens. Posted this question to Apple's website but then I thought I would have better luck here. Any help would really be appreciated I've searched google for hours and I'm kind of at a dead end.
Modified Code:
using terms from application "Messages"
on message received theMessage from theBuddy for theChat
tell application "Mail"
set theNewMessage to make new outgoing message with properties
{subject:"thesubject", content:theMessage, visible:true}
tell theNewMessage
make new to recipient at end of to recipients with properties
{address:"myemail#gmail.com"}
send
end tell
end tell
end message received
on completed file transfer theFile
beep 4
end completed file transfer
end using terms from
So with a bit more looking I learned that Messages is very similar to iChat which I found some example code on Apple's Developer site:
https://developer.apple.com/library/mac/#samplecode/iChatAppleScriptSamples/Listings/Add_Incoming_Images_to_iPhoto_Add_incoming_image_to_iPhoto_applescript.html
So I changed my code to this:
on received file transfer invitation theFileTransfer
accept transfer of theFileTransfer
tell application "Mail"
set theNewMessage to make new outgoing message with properties
{subject:"photo", content:"themessage", visible:true}
tell theNewMessage
make new to recipient at end of to recipients with properties
{address:"myemail#gmail.com"}
send
end tell
end tell
end received file transfer invitation
I also made sure to have the script run when incoming file in the Messages preferences window, but still not getting any response. Very frustrating, I'm thinking that a picture might not be a file transfer but rather an inline text attachment of sorts.
Looking at the Messages dictionary I found:
attachment n [inh. rich text] : Represents an inline text attachment. This class is used mainly for make commands.
elements
contained by rich text, characters, paragraphs, words, attribute runs.
properties
file (file, r/o) : The path to the file for the attachment syn file name
But I have no idea how to use classes in AppleScript.
Again any help would be greatly appreciated!
I’ve been in AppleScript hell for the past few days. Apparently, when Apple changed how Messages.app deals with events (one event handler instead of a script per event), they either broke or failed to implement file transfer-related stuff.
Attachments are not accessible because you are never given a file object; rather (you’ve discovered) you get a message string and user and chat objects.
There’s good news in all of this, though (kind of). on message received is triggered for text messages and media messages. For media messages, the text string your handler gets is empty. You can hit up last file transfer to see if anything was recently received and act accordingly.
Here’s the nasty hack I’m using in the message received handler to get attachments:
set fileName to ""
if direction of last file transfer is incoming then
-- compare diff in seconds
if (current date) - (started of last file transfer) < 5 then
set f to file of the last file transfer
set fileName to POSIX path of f
end if
end if
Do note that it’s only the start of an idea. I haven’t had time to improve it since I banged it out a few days ago. You’ll get the full path to the file in fileName if the message has media.
For the Mail.app side of things, basically, I have no clue. To send images with Messages.app, I’m using set theMessage to POSIX file fileName. Probably something along those lines for setting the file for attachment.
AppleScript is like messed up English, which is why you can use first and last and 2nd and even 1th or 3nd. You can do stuff like get number of file transfers but get number of file transfer is also valid.
Partially related: checkout out properties if you ever want to inspect an object. properties plus the AppleScript Editor (as in get properties of first chat) are a lifesaver.
Good luck.

powershell - link to attached file in mail message

I can't find the solution for my problem. So, in my send-mailmessage html body is field that should be redirected to file which is included as attachment in message. How can I create hyperlink to that file in mail, when client opens it?
I don't know if you get my idea. In other words, in message I have attached file, and then there is field which should be a hyperlink to attached file. When client receives message he/she should press the link and then attached file opens.
I searched almost everything in everwhere but can't find a appropriate solution how to solve this.
This isn't really a PowerShell question, since this issue has nothing to do with the functionality of the Send-MailMessage cmdlet.
In any case, the reason you can't find a solution anywhere is that what you're trying to do is impossible. There is no way that a hyperlink in an e-mail message can point to a file attached to that message. Different mail clients on different operating systems store attachments in different locations. Even if you want to assume that all your recipients are running Outlook on Windows, there are different versions of both. Even if you know for a fact that all recipients are running a specific version of Outlook on a specific version of Windows, you're still out of luck. Outlook stores attachments in a subfolder in the Temporary Internet Files in the user's profile that has a randomly generated name. There's no way to inject code into a hyperlink in an email message, so without knowing the exact local file location, you can't link to it.
I suppose if you're really determined you could have the hyperlink point to a web page that runs some complex javascript code that tries to figure out where the attachment is stored, but that's a major undertaking, and would break if the recipient's default browser has javascript disabled.
Which begs the question, why exactly are you trying to do this? So that recipients can click once instead of having to double-click to open the attachment?
I have found that you can make a hyperlink point to a file share that you know the recipients have access to.
To do so:
Simply make each hyperlink point to the specific file and there you have it.
They have to have permissions to access that file share, or there is a much better way now that I haven't thought of.
Oh well, this works for me, for now.

Coldfusion 9 - respool mail

I had a bunch of mail to be sent out that was not. I realized that my mail settings in Coldfusion Administrator were incorrect and have since corrected them. I tested the new settings with new mail and they work. I am now trying to re-send out the messages in the spool, but they go right back in the undelivered mail spool. I'm assuming that they are still using the old mail settings. Is there any way to force them to send out using the new current settings?
You'll need to edit the individual spool files, as they most likely have the mail server information in the file itself. If you open a few of the files in your badmail directory, you should be able to locate the server information and adjust accordingly.
If you can do a bulk find/replace on the files, it should make short work of it.

Use Automator to email a word doc

I do work over a few computers and use my email address to keep an extra save copy of my files. I'd like to have an Automator service for Microsoft Word that sends an email to myself with the current word doc as an attachment and the title as the subject. If I could have a macro in Word that did the same thing that would also be great. Thanks.
You can either run this as an AppleScript by itself or insert the AppleScript in your Automator workflow.
tell application "Microsoft Word"
try
set theTitle to name of front document
end try
send mail front document
end tell
tell application "Mail"
activate
tell its outgoing message 1
set subject to theTitle
end tell
end tell

How do browsers communicate with email programs?

I've searched around for a bit, but haven't been able to find anything useful on this.
How do browsers communicate with email programs, such as Thunderbird and Outlook (on the Mac, if that's relevant)?
By communicate, I mean the process it goes through to create a new email window with a designated to address, subject, body, through the mailto: link. How does the browser let the email program know what to put for each field? Using the command line (for Thunderbird, at least) didn't make much sense, as that opens a brand new instance of Thunderbird on the Mac.
I haven't found any sort of API for this, so if someone can point me in the right direction, that would be greatly appreciated. Thanks!
On windows, the browser use the "default" email client defined by the system.
It's stored in the Windows registry and define the command line to open the mail program. You can find more info and an exemple on the Microsoft website.
http://msdn.microsoft.com/en-us/library/windows/desktop/cc144109%28v=vs.85%29.aspx#sample_mail_program
If I look in my registry for thunderbird, It seems to execute:
"C:\Program Files\Mozilla Thunderbird\thunderbird.exe" -osint -compose "%1"
I have no idea how it works for the mac!
the additional information sent to the mail client is usually (from what i have seen) tacked onto the back of the mailto command.
in the following example, the client should automatically fill in the subject as 'greetings from stackoverflow'
mailto:hello#example.com?subject=greetings from stackoverflow
i have listed the other commands i know of below:
to edit subject: ?subject=
to edit cc: ?cc=
to edit bcc: ?bcc=
to edit body content: ?body=
these can also be used together by placing them after eachother and swapping the '?' for a '&', example
mailto:hello#example.com?subject=hello there&body=goodbye
this should create an email with the subject of 'hello there' and a body message of 'goodbye'
i hope this helps!
A very useful oldies that explains the surface called RCDefault
It shows you that the Finder or the Browser uses (can use) URLs to call other applications.
I am attaching the screenshot for the Mail application on OSX here:
The OS will then call this application with the URL (or file) and the application is supposed to understand how to open that URL.
The URL scheme for the mailto protocol for apple, is here
You should be able to find other schemes for the application you need to use.