Question

How can I attach a file to this mailto string?

string mailto = "mailto:" + to + "&SUBJECT=" + subject + "?BODY=" + body + 
    "&Attachment=" + attachment;

This doesn't work; the file isn't attached.

Was it helpful?

Solution

Remove the quotes at the end of "attachment".

"mailto:" + to + "&SUBJECT=" + subject + "?BODY=" + body + "&Attachment=" + attachment

Where attachment has the attachment link.

Note: This will not work if the users dont have access to the attachment so you can try attaching and sending it through a c# code.

OTHER TIPS

From what I saw on the web (and by trying it to), it is not always possible to do so. Some email client, and by some I mean lots of them, will not let you do this because it is considered a security hole. However, when it is accepted, the syntax provided by Shodan looks good.

Try this

var proc = new System.Diagnostics.Process();
proc.StartInfo.FileName = string.Format("\"{0}\"", Process.GetProcessesByName("OUTLOOK")[0].Modules[0].FileName);
proc.StartInfo.Arguments = string.Format(" /c ipm.note /m {0} /a \"{1}\"", "someone@somewhere.com", @"c:\attachments\file.txt");
proc.Start();
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top