Email This for Internet Explorer
UPDATE
I removed the dependency for blat and cleaned up the script a little bit.
Only drawback, the browser window blocks until the mail is sent. To be continued...
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<!-- saved from url=(0016)http://localhost -->
<html>
<head>
<title>Mail This</title>
</head>
<body>
<p>This is a pure Javascript HTML file. Purpose is to be invoked from an Internet Explorer context menu (right-click) to send the link to a defined email account for later review.</p>
<pre>
Windows Registry Editor Version 5.00
[HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\MenuExt\Email this]
@="C:\\\\Users\\Admin\\AppData\\Local\\Perimeterless\\EmailThis.html"
"Contexts"=dword:00000031
</pre>
<script type="text/javascript">
var strEmailServer = "smtp.hacky.eu";
var strEmailTo = "c@hacky.eu";
var strEmailFrom = "Email This <Email.This@hacky.eu>";
// Get content
var aWindow = window.external.menuArguments;
var aDocument = aWindow.document
var aSelection = aDocument.selection;
var aSelectedRange = aSelection.createRange();
var sSelectedText = aSelectedRange.text;
var anEvent = aWindow.event;
var anElement = anEvent.srcElement;
var strSubject = anElement.outerText;
var strURL = anElement.href;
if ( strURL == null ) {
strSubject = aWindow.document.title;
strURL = aWindow.document.URL;
} //END if
var strTextBody = strSubject + "\n" + strURL;
if (sSelectedText.length != 0){
strTextBody = strTextBody + "\n" + sSelectedText;
} //END if
sendEmail();
function sendEmail() {
//alert("Hello");
var msg = new ActiveXObject("CDO.Message");
var config = new ActiveXObject("CDO.Configuration");
config.Fields("http://schemas.microsoft.com/cdo/configuration/sendusing")=2;
config.Fields("http://schemas.microsoft.com/cdo/configuration/smtpserver")= strEmailServer;
config.Fields("http://schemas.microsoft.com/cdo/configuration/smtpserverport")=25;
config.Fields("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate")=1;
config.Fields.Update();
msg.Configuration = config;
msg.From = strEmailFrom;
msg.To = strEmailTo;
msg.Subject = strSubject;
//msg.HTMLBody = strHTMLBody;
msg.TextBody = strTextBody;
msg.Send();
msg=null;
config=null;
}; // END sendEmail
</script>
</body>
</html>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<!-- saved from url=(0016)http://localhost -->
<html>
<head>
<title>Mail This</title>
</head>
<body>
<p>This is a pure Javascript HTML file. Purpose is to be invoked from an Internet Explorer context menu (right-click) to send the link to a defined email account for later review.</p>
<pre>
Windows Registry Editor Version 5.00
[HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\MenuExt\Email this]
@="C:\\\\Users\\Admin\\AppData\\Local\\Perimeterless\\EmailThis.html"
"Contexts"=dword:00000031
</pre>
<script type="text/javascript">
var strEmailServer = "smtp.hacky.eu";
var strEmailTo = "c@hacky.eu";
var strEmailFrom = "Email This <Email.This@hacky.eu>";
// Get content
var aWindow = window.external.menuArguments;
var aDocument = aWindow.document
var aSelection = aDocument.selection;
var aSelectedRange = aSelection.createRange();
var sSelectedText = aSelectedRange.text;
var anEvent = aWindow.event;
var anElement = anEvent.srcElement;
var strSubject = anElement.outerText;
var strURL = anElement.href;
if ( strURL == null ) {
strSubject = aWindow.document.title;
strURL = aWindow.document.URL;
} //END if
var strTextBody = strSubject + "\n" + strURL;
if (sSelectedText.length != 0){
strTextBody = strTextBody + "\n" + sSelectedText;
} //END if
sendEmail();
function sendEmail() {
//alert("Hello");
var msg = new ActiveXObject("CDO.Message");
var config = new ActiveXObject("CDO.Configuration");
config.Fields("http://schemas.microsoft.com/cdo/configuration/sendusing")=2;
config.Fields("http://schemas.microsoft.com/cdo/configuration/smtpserver")= strEmailServer;
config.Fields("http://schemas.microsoft.com/cdo/configuration/smtpserverport")=25;
config.Fields("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate")=1;
config.Fields.Update();
msg.Configuration = config;
msg.From = strEmailFrom;
msg.To = strEmailTo;
msg.Subject = strSubject;
//msg.HTMLBody = strHTMLBody;
msg.TextBody = strTextBody;
msg.Send();
msg=null;
config=null;
}; // END sendEmail
</script>
</body>
</html>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<!-- saved from url=(0016)http://localhost -->
<html>
<head>
<title>Mail This</title>
</head>
<body>
<p>This is a pure Javascript HTML file. Purpose is to be invoked from an Internet Explorer context menu (right-click) to send the link to a defined email account for later review.</p>
<pre>
Windows Registry Editor Version 5.00
[HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\MenuExt\Email this]
@="C:\\\\Users\\Admin\\AppData\\Local\\Perimeterless\\EmailThis.html"
"Contexts"=dword:00000031
</pre>
<script type="text/javascript">
var strEmailServer = "smtp.hacky.eu";
var strEmailTo = "c@hacky.eu";
var strEmailFrom = "Email This <Email.This@hacky.eu>";
// Get content
var aWindow = window.external.menuArguments;
var aDocument = aWindow.document
var aSelection = aDocument.selection;
var aSelectedRange = aSelection.createRange();
var sSelectedText = aSelectedRange.text;
var anEvent = aWindow.event;
var anElement = anEvent.srcElement;
var strSubject = anElement.outerText;
var strURL = anElement.href;
if ( strURL == null ) {
strSubject = aWindow.document.title;
strURL = aWindow.document.URL;
} //END if
var strTextBody = strSubject + "\n" + strURL;
if (sSelectedText.length != 0){
strTextBody = strTextBody + "\n" + sSelectedText;
} //END if
sendEmail();
function sendEmail() {
//alert("Hello");
var msg = new ActiveXObject("CDO.Message");
var config = new ActiveXObject("CDO.Configuration");
config.Fields("http://schemas.microsoft.com/cdo/configuration/sendusing")=2;
config.Fields("http://schemas.microsoft.com/cdo/configuration/smtpserver")= strEmailServer;
config.Fields("http://schemas.microsoft.com/cdo/configuration/smtpserverport")=25;
config.Fields("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate")=1;
config.Fields.Update();
msg.Configuration = config;
msg.From = strEmailFrom;
msg.To = strEmailTo;
msg.Subject = strSubject;
//msg.HTMLBody = strHTMLBody;
msg.TextBody = strTextBody;
msg.Send();
msg=null;
config=null;
}; // END sendEmail
</script>
</body>
</html>
OLD ARTICLE BELOW
THIS ARTICLE IS WORK IN PROGRESS
The whole bookmarking, sync, interact, knowledge management, social networking thing is kind of tied to third party online services. A user not willing to participate is left out more or less.
I am trying to create my own personal management environment with a private system mainly running an IMAP/SMTP and web server. So far the server side is running fine and the main problems are the user interfaces. For example the IMAP server offers everything for a RSS feeds syncing system but the standard mail readers weren't really ment for this purpose especially not on mobile devices.
Anyyway, this little tool adds the functionality to the Internet Explorer context menu when clicked on a link to mail the destination directly to an email account. It uses the good old Blat to do so.
In a way it is a little bit like the Send to Kindle or Read It Later service. But if you host your own private SMTP server no third party ever knows the articles you are interested in. Now isn't that something?
- Create a registry file adding the context menu entry and execute.
- Save the HTML code to a location sosmewhere in your user profile path on disk and edit it to fit your server and email address.
- Download Blat and put the files besides the HTML code
- Your good to go
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<!-- saved from url=(0016)http://localhost -->
<html>
<head>
<title>Mail This</title>
</head>
<body>
<p>This is a pure Javascript HTML file. Purpose is to be invoked from an Internet Explorer context menu (right-click) to send the link to a defined email account for later review.</p>
<pre>
Windows Registry Editor Version 5.00
[HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\MenuExt\Email this]
@="c:\\\\Temp\\\\MailThis\\\\MailThis.htm"
"Contexts"=dword:00000020
</pre>
<script type="text/javascript">
var strTempDir,
strPath,
strFile,
strBody,
strSMTPServer,
strRecipient,
strFrom;
strSMTPServer = "smtp.google.com";
strRecipient = "c@google.com";
strFrom = "\"Email This <Email.This@google.com>\"";
setEnv();
createTempFile(strBody);
strCommand = strPath + "\\blat.exe";
strArguments = strTempDir + "\\\EmailThisBody.txt -server " + strSMTPServer + " -to " + strRecipient + " -f " + strFrom + " -subject \"" + strSubject + "\"";
//alert( strCommand + " " + strArguments );
runCmd( strCommand + " " + strArguments );
function createTempFile(strContent)
{
var myObject,
newfile;
myObject = new ActiveXObject("Scripting.FileSystemObject");
newfile = myObject.CreateTextFile(strTempDir + "\\EmailThisBody.txt", true);
newfile.WriteLine(strContent);
newfile.Close();
}
function runCmd(command, option) {
var wsh = new ActiveXObject('WScript.Shell');
if (wsh) {
wsh.exec(command);
}
}
function setEnv() {
// Get Meta Info
// strBody = prompt("Please provide addtional information", "Default");
// Get temp dir
var myObject
myObject = new ActiveXObject("Scripting.FileSystemObject");
strTempDir = myObject.GetSpecialFolder(2);
// Get working dir
var file = document.location.pathname;
strPath = file.substring( 0, file.lastIndexOf("\\") );
// Get content
var aWindow = window.external.menuArguments;
var aDocument = aWindow.document;
var anEvent = aWindow.event;
var anElement = anEvent.srcElement;
strBody = strBody + "\n" + anElement.href;
strSubject = anElement.outerText;
}
</script>
</body>
</html>
