+ Start a Discussion
Rajesh ShahRajesh Shah 

To attach a file from SControl

I have a written a scontrol which implements the send email functionality.
In that I am able to attach a document already uploaded in Salesforce. But if I need to attach a document that resides on my PC and not in Salesforce, is it possible to do that in a Scontrol?
Probably not, but why would you need an Scontrol for that?  The standard Send An Email page allows you to do that.  Just click Send An Email, then click New in the attachments and navigate to a document in My Computer.
Rajesh ShahRajesh Shah
Due to certain requirements of the Client, I have build a custom Send An Email page.
Now I need to make the Attach file part working. In order to attach a file, I am first inserting the file as an attachment. However the Attachment body field takes the file as Base64 format. Is there any way I can insert an attachment in base64 format in Javascript or in Apex Classes?
Well, good luck with that.  I'm still not sure you'll be able to attach it to an outbound email.  There are a bunch of base64 encoders in Javascript on the web, just google "base64 javascript."
Hello.  Were you able to make this work?  Is it possible to grab a file from the local filesystem?

Rajesh ShahRajesh Shah


I was able to do it. If you still need help let me know.


Message Edited by Rajesh Shah on 09-04-2008 06:25 AM

dear Rajesh,


would you be so kind to publish the necessary code here? I have kind of the same problem, attaching a file from file system or another document server (based on Webdav).






Hello Rajesh,


My name is abhijeet and i have started working on salesforce from 2 months ago.

My boss has told me the same requirements as attaching a file to the email through a Scontrol.

I am not having any idea how it works and will be really very happy if you can help me.


And can we attach multiple files from the local PC?


I feel this is gonna be difficult, but cant help need to do it.


My contact number is +81 80 3444 6487.

You can give me your number if it is feasible and i can give you a call.


Thanks in advance, hoping for a positive reply  :).