I have a web page that displays a list of documents stored on the web site. I need to add a link next to each document that can e-mail it. By that I mean attach the entire document to the e-mail.
When clicking the e-mail link, a 'New Message' window needs to display with:
Subject line filled in with the title of the document (displayed on the web page)
Contents of the document downloaded from the web site and added as an attachment
The mail client is Outlook. The server is SharePoint (ASP.NET) which contains web services that are able to download files. JavaScript and any JS library is available for use. I'm not able to deploy additional software to the client.
What are my options and are there any references that achieve this type of functionality?
An alternative might be to put a link in the body of the message to a place where the file can be downloaded. You could even make it a web page that deletes the file after a set time or number of downloads. To be safe you would need to use "mailto:someone#somewhere.com&subject=somesubject&body="+System.Web.HttpUtility.UrlEncode(bodyStringToEncode) to generate an html safe llink
Even with the above answer about launching an email using office automation, you'd still need to first have the file sent to the client, saved in a name and location known to the server, in order to attach the file.
I can't think of a way to attach the document but you can have a link to fill in the subject and body of an email in which you could add a link to the online document.
<a href="mailto:test#test.com?subject=
[your_subject]&body=[url_encoded_content_string]">New Message</a>
You can use this function to urlencode your body text http://phpjs.org/functions/urlencode
Hope that helps,
Josh
Using the HREF mailto, you can make outlook open with the subject at least. I don't know any way to set the body nor an attachment.
From javascript there's no way to automate Outlook using OLE.
example
Taken from:
http://www.angelfire.com/dc/html-webmaster/mailto.htm
Related
After uploading a PDF to the Media Archive, I am trying to link to it from a page on a site.
While editing content, I use the hyperlink tool then select the PDF I want to link to via the URL input box.
After saving and publishing the content, clicking the link downloads the PDF and I don't see any apparent way to make this view-able in the browser by using the current Media ID Composite provides. When rendered, we get this:
pdf
Is there a way that I can reference a PDF without using the Media ID and simply use the file name instead?
Here is the Request/Response header info:
After reading what Pauli Østerø said, I understand the problem but am still not able to think of a solution.
I can get the PDF to view in the browser by adding ?download=false to the href URL via Developer Tools. But when I try to add ?download=false to the href through Composite, it doesn't take affect and I get the console output: "Resource interpreted as Document but transferred with MIME type application/pdf: "http://c1.wittenauers.com/media/4afb7bc8-f703-469d-a9b2-a524d8f93dcb/ryc7iw/CompositeDocumentation.PDF"."
Here is the network trace that was asked for by Pauli. In the image, I included the bit where I add ?download=false to the URL, in source view, just in case there could be another way to add it.
Edit: URL and headers for the page.
Here is the link to the page that contains the link:
http://c1.wittenauers.com/cafe/test
Here is the headers for the page containing the link:
From what you're experiencing, it seems to me that Composite have gotten the MIME type of your uploaded file wrong, and is therefor not correctly telling the browser that this file is a pdf, and the browser doesn't know what to do with it.
Try deleting the file and uploading it again.
Try add ?download=false and the end of the href to the file. You prob. need to go into source mode of the content editor.
This is the exact line in the Source Code which is responsible for this behavior, and the logic is as follows
If there is no Querystring named download, the attachment is determined by the Mime Type. Only png, gif and jpeg will be shown inline, the rest will be shown as attachment.
If there is a Querystring named download with a value of false, it will override the Mime Type check and always force the Content-Disposition to be inline.
I made a quick test here to show that the behaviour is a expected. At least in my Chrome browser in Windows 8
Force download: https://www.dokument24.dk/media/9fdd29da-dde8-41f7-ba4c-1117059fdf06/z8srMQ/test/Prisblad%202015%20inkl%20moms.pdf
Show in browser: https://www.dokument24.dk/media/9fdd29da-dde8-41f7-ba4c-1117059fdf06/z8srMQ/test/Prisblad%202015%20inkl%20moms.pdf?download=false
Expanding on Pauli's answer, you can add the following snippet to your page template to automatically add the '?download=false' to all pdf links.
$("a").each(function () {
if (this.href.includes(".pdf")) {
this.href = this.href + "?download=false";
}
})
I want to send an email with attachments using CDONTS. But, here is what i am using:
CDO_MAIL.AttachFile "http://SampleWebSite.com/Sample.asp?COMMAND=6"
In JavaScript we are doing:
image1.src = "http://SampleWebSite.com/Sample.asp?COMMAND=6"
The problem is - I do not have the exact image name. The above URL returns me an image. Can you please let me know how to resolve this ?
Thanks
Diodeus is correct. However, another way to "solve" this is to download the file so you have it locally and then attach it. Embedding in the HTML, as suggested by Diodeus, will cause most mail clients to block the image and require user interaction to download the image. It's better to do it attach it and reference it by CID.
CDO does not support HTTP. It's expecting a local file reference (C:....).
You can embed the image in the message body though, using simple HTML:
<img src="http://SampleWebSite.com/Sample.asp?COMMAND=6" />
I have a script that sends an email with an html attachment. When I select "view" in gmail I get text...however when I click on "download" instead of "view", then open it, it displays as it should.
I think it's gmail related because I observe the exact same behavior from IE, FireFox(win/linux), Chrome(win/linux)
I made a youtube video of here:
http://www.youtube.com/watch?v=WkGyxcFQXS8
Am I doing something wrong?
Thanks
Not all email clients support the <style> tag. Gmail is one of those; it only respects in-line styling.
If your code is producing the css & html, then you could change it to use in-line styles for the table.
If you want something more auto-magic, see How do I use Google Apps Script to change a CSS page to one with inline styles?.
One way around this would be to have your script simply host the HTML file somewhere, and email a link to that file.
I cannot find any documentation from Google or the GMail team, but I would be surprised if they allowed HTML attachments to be opened and viewed (this would be a security risk, since they would essentially allow their email servers to host user-generated web content).
Is there any way of finding the absolute URL for a published object in the SDL Tridion Interface?
For example when I published a page, how can I find the url where to access the page?
Though not finished, and not really very documented, the Tridion 2011 PowerTools includes 2 buttons to "Open in Staging" and "Open in Live".
If you're looking for the code in your c# tbb library you can use the PublishLocationUrl property for pages and structure groups:
StructureGroup.PublishLocationUrl or
Page.PublishLocationUrl
This will return the URL if the item is published or not, as Page and StructureGroup extend the ReposityObject class, I typically perform a check to see if the ReposityObject is published to the target that the Page is being published to for example:
if (PublishEngine.IsPublished(myReposityObject, myEngine.PublishingContext.PublicationTarget))
{
// page or sg is published!
}
Note: Where the myEngine is an instance of the Engine object.
If you're doing this in the core service, that's a little different, what you need to do is create a PublishLocationInfo object which is casted from your Page or StructureGroup object property LocationInfo, as shown below:
PublishLocationInfo pubInfo = (PublishLocationInfo)page.LocationInfo;
return pubInfo.PublishLocationUrl;
It is not very straightforward, mostly because Tridion allows you to publish a single page to multiple targets (= web sites). The page could in fact have a number of URLs.
However, the best option is to open the page and click on the Info tab. There you will find the File Path, which might look like this: \about\press\2011. Replace the backslashes with slashes, and add the page's filename and file extension (can be found on the General tab). Put the whole thing behind the root URL of your web site (e.g. http://www.mysite.com').
Tridion exposes the path of the URL in PublishLocationUrl property. You can access this either through the TOM.NET API or by viewing the raw XML of the item by entering the TCMURI in the address bar of Internet Explorer (e.g. tcm:4-264-64).
But in either case those will just return the path part of the URL. You'll have to prefix it with the correct base URL as Quirijn already mentioned earlier.
In the past, I have resorted to extending the protocol schemas for publication target destinations. Having added a baseURL property there, I could access this from events system code (the idea was to mail a link to a workflow approver).
These days, you could use application data to do the same thing.
I am programming a control to allow the users of our intranet to upload multiple files into our system, but with some added functionality.
Imagine you as a user are uploading N files, when you add N files the intranet presents you a list like this:
File_name_1 ..... [View] [Remove] [Upload]
File_name_2 ..... [View] [Remove] [Upload]
.
.
.
File_name_n ..... [View] [Remove] [Upload]
[Remove all file] [Upload all files]
If you clic on the View button the file named "file_name_X" will be opened so you can review it and be sure it really is the file you want to upload.
Is this possible?, I am new on the Web programming world and all I found suggest the browsers do not allow you to access local file system from inside a web, but I am not sure.
One way to do this is that you actually upload initially but you only upload it to a "Staging" area. Thus it wouldn't have actually been committed to your system.
This is what Gravatar does which uploads the file and then lets you crop and adjust the image before saving it.
The only other way I've seen this done is using an ActiveX control for example in IE or some other browser extension mechanism.
Uploading files while presenting a good user interface, including progress reporting about the upload, is hard.
I suggest the Yahoo UI uploader widget: http://developer.yahoo.com/yui/uploader/
It's also the basis for the Flickr uploader, see the YUI blog post:
http://yuiblog.com/blog/2009/02/26/flickr-uploadr/
Larry
In IE the file input type will put the full path in the value attribute.