Solved

Join File to email

Posted on 2009-07-06
9
235 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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

What is C++ STL?: STL stands for Standard Template Library and is a part of standard C++ libraries. It contains many useful data structures (containers) and algorithms, which can spare you a lot of the time. Today we will look at the STL Vector. …
Jaspersoft Studio is a plugin for Eclipse that lets you create reports from a datasource.  In this article, we'll go over creating a report from a default template and setting up a datasource that connects to your database.
This tutorial covers a step-by-step guide to install VisualVM launcher in eclipse.
The viewer will learn how to pass data into a function in C++. This is one step further in using functions. Instead of only printing text onto the console, the function will be able to perform calculations with argumentents given by the user.

895 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

12 Experts available now in Live!

Get 1:1 Help Now