Solved

Join File to email

Posted on 2009-07-06
9
233 Views
Last Modified: 2013-12-14
Hi,
I send a post yesterday in order to pop up the user mail if an error occur in my application.
here is the code to compute that :

void SendErrorMail()
{
LPCTSTR pszCmd = _T("mailto:....&subject=.....&body=......");
ShellExecute(NULL,_T("open"),pszCmd,NULL,NULL,SW_SHOW);
}

I would like to join a file to the mail. Is there an easy way to do that ?
 Especially, can We automaticly make a screenshot and join it to the mail ?
Thank you
0
Comment
Question by:fructuoso
  • 3
  • 3
  • 2
  • +1
9 Comments
 
LVL 17

Expert Comment

by:CSecurity
ID: 24783505
You have to add in this line:
LPCTSTR pszCmd = _T("mailto:....&subject=.....&body=......");
Attach=YOURFILE

like:
LPCTSTR pszCmd = _T("mailto:....&subject=.....&body=......&Attach="C:\Screenshot.jpg");

For taking screen shot you can try this link:
http://www.codeproject.com/KB/mcpp/ijwscrcap.aspx
0
 
LVL 17

Expert Comment

by:CSecurity
ID: 24783511
Or
&attachments=""C:\Screenshot.jpg""

Try &Attach and &attachments

one of them should work
0
 
LVL 5

Expert Comment

by:iUsername
ID: 24783515
you forge the mailto with "attachment":

mailto:blabla@bla.com?subject=mySubject&body=MyBody&attachment="c:\myfile.txt"
0
 

Author Comment

by:fructuoso
ID: 24783533
Hi thanks for your reply
I was trying the parameter Attach and i have problem for the synthax for the file path.

I tried
......&Attach="\"C:\\Screenshot.jpg\"")  --> doesn't work

I just tried yours which didn't work too.
I keep on looking but if you have any idea that would be great
Thank you
0
Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

 
LVL 39

Expert Comment

by:itsmeandnobodyelse
ID: 24783642
0
 
LVL 39

Expert Comment

by:itsmeandnobodyelse
ID: 24783661
You may download blat for your purposes:

http://sourceforge.net/projects/blat/files/
0
 

Author Comment

by:fructuoso
ID: 24783665
Ok, I know where the file will be becuse i will create it and put it where i want. I just need to know what is the syntax for the file path to use th attachment parameter. Can you help me to do that ?
Thank you for your reply
0
 
LVL 39

Accepted Solution

by:
itsmeandnobodyelse earned 500 total points
ID: 24783839
>>>> I just need to know what is the syntax for the file path to use th attachment parameter.
If you read the first link I posted you will see that the answer is 'no', i. e. you can't add attachments when using mailto from commandline.

I don't know it from my own experiences but I googled some time and actualy found not one single evidence for a mailto command with attachments. So, the answer of DreamMaster in the linked thread seems quite ok.

But the blat was able to do what you want:

Excerpt from download information:
-----------------------------------------------------
Enables you to send quick mail messages directly from the command line. It will allow you to attach files to your message. For example, using 'blat - -t destid@xyz.com -s 'test' -attach abc.zip -attach def.zip' will accept keyboard input for a mail message, and send that text with 2 zip files attached! Message text can come from a file as well. Supports MIME quoted-printable and base64 encoding.Information about your mail id & server is stored in the registry, or can be over-ridden on the command line. Excellent for batch files. Includes source.
-----------------------------------------------------
0
 

Author Comment

by:fructuoso
ID: 24784638

Sorry about my missunderstanding.
However I found an other solution.
Someone compute a class in order to do that. Here is the link for programmer who will have the same problem :
http://www.codeproject.com/KB/IP/SendTo.aspx?fid=257922&fr=1&df=90&mpp=25&noise=3&sort=Position&view=Quick#xx0xx

Anyway, thank you for your help

0

Featured Post

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

Introduction This article is a continuation of the C/C++ Visual Studio Express debugger series. Part 1 provided a quick start guide in using the debugger. Part 2 focused on additional topics in breakpoints. As your assignments become a little more …
Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
The viewer will learn how to use the return statement in functions in C++. The video will also teach the user how to pass data to a function and have the function return data back for further processing.
The viewer will learn how to clear a vector as well as how to detect empty vectors in C++.

707 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now