Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

using mailto to send email with an attachment

Tags:

html

How can i send an email with an attachment (either local file or a file in the intranet) using outlook 2010?

<a href="mailto:[email protected]?subject=my report&body=see attachment&attachment=c:\myfolder\myfile.txt"> 

doesn't seem to work.

like image 686
Benchik Avatar asked Mar 08 '11 14:03

Benchik


People also ask

How do you send an email with an attachment and reply?

Attach a file to a message Create a message, or for an existing message, click Reply, Reply All, or Forward. In the message window, on the Message tab, in the Include group, click Attach File. Browse to and click the file that you want to attach, and then click Insert.

How do you attach an HTML file to an email?

You can inject HTML code into the message body via the Insert as Text option; tab Insert-> (Attach) File-> select the created htm-file-> press the down arrow on the Insert button-> Insert as Text.


2 Answers

Nope, this is not possible at all. There is no provision for it in the mailto: protocol, and it would be a gaping security hole if it were possible.

The best idea to send a file, but have the client send the E-Mail that I can think of is:

  • Have the user choose a file
  • Upload the file to a server
  • Have the server return a random file name after upload
  • Build a mailto: link that contains the URL to the uploaded file in the message body
like image 177
Pekka Avatar answered Oct 07 '22 15:10

Pekka


this is not possible in "mailto" function.

please go with server side coding(C#).make sure open vs in administrative permission.

Microsoft.Office.Interop.Outlook.Application oApp = new Microsoft.Office.Interop.Outlook.Application(); Microsoft.Office.Interop.Outlook.MailItem oMsg = (Microsoft.Office.Interop.Outlook.MailItem)oApp.CreateItem(Microsoft.Office.Interop.Outlook.OlItemType.olMailItem);  oMsg.Subject = "emailSubject"; oMsg.BodyFormat = Microsoft.Office.Interop.Outlook.OlBodyFormat.olFormatHTML; oMsg.BCC = "emailBcc"; oMsg.To = "emailRecipient";  string body = "emailMessage";  oMsg.HTMLBody = "body";               oMsg.Attachments.Add(Convert.ToString(@"/my_location_virtual_path/myfile.txt"), Microsoft.Office.Interop.Outlook.OlAttachmentType.olByValue, Type.Missing, Type.Missing);  oMsg.Display(false); //In order to displ 
like image 44
Boopathi.Indotnet Avatar answered Oct 07 '22 14:10

Boopathi.Indotnet