473,789 Members | 3,067 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

System.Diagnost ics.Process.Sta rt c# query

Hi All,

I am using c# to build an application. I want a button that will be able to
open a new mail message with an attachment. The new mail message works but I
can't get the attachment to work - there is no error message just no
attachment. Any ideas? Code i am using is;

System.Diagnost ics.Process.Sta rt("mailto:em** *@email.com?sub ject=Software&b ody=see attachment&atta chment=c:/myview.mht");

Thanks
Jan 4 '08 #1
5 9740
On 4 Jan, 11:44, JimJob <Jim...@discuss ions.microsoft. comwrote:
Hi All,

I am using c# to build an application. I want a button that will be able to
open a new mail message with an attachment. *The new mail message works but I
can't get the attachment to work - there is no error message just no
attachment. *Any ideas? *Code i am using is;

System.Diagnost ics.Process.Sta rt("mailto:em.. .@email.com?sub ject=Software&b ody=see attachment&atta chment=c:/myview.mht");

Thanks
try c:\ and prefix the string with an @

ie

(@"mailto:em... @email.com?subj ect=Software&bo dy=see
attachment&atta chment=c:\myvie w.mht"

@ will stop the compiler treating \ as an escape character.
Jan 4 '08 #2
Thanks developer - but no joy. I have also tried @ C:\ or C:/ to no avail

"DeveloperX " wrote:
On 4 Jan, 11:44, JimJob <Jim...@discuss ions.microsoft. comwrote:
Hi All,

I am using c# to build an application. I want a button that will be able to
open a new mail message with an attachment. The new mail message works but I
can't get the attachment to work - there is no error message just no
attachment. Any ideas? Code i am using is;

System.Diagnost ics.Process.Sta rt("mailto:em.. .@email.com?sub ject=Software&b ody=see attachment&atta chment=c:/myview.mht");

Thanks

try c:\ and prefix the string with an @

ie

(@"mailto:em... @email.com?subj ect=Software&bo dy=see
attachment&atta chment=c:\myvie w.mht"

@ will stop the compiler treating \ as an escape character.
Jan 4 '08 #3
Hi,

I'm not sure if you can do it. mailto is intended to be used from a webpage,
there is no way to attach a local file from a webpage's link

--
Ignacio Machin
http://www.laceupsolutions.com
Mobile & warehouse Solutions.
"JimJob" <Ji****@discuss ions.microsoft. comwrote in message
news:55******** *************** ***********@mic rosoft.com...
Hi All,

I am using c# to build an application. I want a button that will be able
to
open a new mail message with an attachment. The new mail message works
but I
can't get the attachment to work - there is no error message just no
attachment. Any ideas? Code i am using is;

System.Diagnost ics.Process.Sta rt("mailto:em** *@email.com?sub ject=Software&b ody=see
attachment&atta chment=c:/myview.mht");

Thanks

Jan 4 '08 #4
On 4 Jan, 13:59, JimJob <Jim...@discuss ions.microsoft. comwrote:
Thanks developer - but no joy. *I have also tried @ C:\ or C:/ to no avail

"DeveloperX " wrote:
On 4 Jan, 11:44, JimJob <Jim...@discuss ions.microsoft. comwrote:
Hi All,
I am using c# to build an application. I want a button that will be able to
open a new mail message with an attachment. *The new mail message works but I
can't get the attachment to work - there is no error message just no
attachment. *Any ideas? *Code i am using is;
System.Diagnost ics.Process.Sta rt("mailto:em.. .@email.com?sub ject=Software&b ody=see attachment&atta chment=c:/myview.mht");
Thanks
try c:\ and prefix the string with an @
ie
(@"mailto:em... @email.com?subj ect=Software&bo dy=see
attachment&atta chment=c:\myvie w.mht"
@ will stop the compiler treating \ as an escape character.- Hide quotedtext -

- Show quoted text -
Ignacio appears to be correct, my apologies. You could always add a
reference to System.Web.Mail and use the classes in there. having a
quick poke, I got:

using System.Web.Mail ;
MailMessage message = new MailMessage();
message.From = "pe****@place.c om";
message.Body = "body";
message.To ="anotherpe**** @place.com";
message.Subject = "subject";
message.Attachm ents.Add(new MailAttachment( @"C:\boot.ini") );
SmtpMail.SmtpSe rver = "smtp.mailserve r.com";
SmtpMail.Send(m essage);

should do it, but if you get a "CDO.messag e not found" message that's
to do with authentication. (I got that error, there seem to be alot of
posts about it!)
alternatively I managed to get this to work using outlook interop, but
again, outlook now has all that cruddy security so it pops up a dialog
saying is this ok?? I'm sure I've read about ways of disabling that,
but it was a while ago.

using Microsoft.Offic e.Interop.Outlo ok;
Microsoft.Offic e.Interop.Outlo ok.Application app =
new Microsoft.Offic e.Interop.Outlo ok.ApplicationC lass();
MailItem message = (MailItem)app.C reateItem(OlIte mType.olMailIte m);

Recipient recip =
(Recipient)mess age.Recipients. Add("pe****@pla ce.com");
recip.Resolve() ;

message.Body = "body";
message.Subject = "subject";
message.Attachm ents.Add(@"C:\b oot.ini",
OlAttachmentTyp e.olByValue,mes sage.Body.Lengt h + 1, "an attachment");
//message.Save();
//message.Display (false);
message.Send();
probably no help, but you never know.
Jan 4 '08 #5
Thanks Developer - I am attempting to to try your second solution - however
it dosent like "using Microsoft.Offic e.Interop.Outlo ok;" am i missing a
required reference? Asking permission to use outlook wont cause a problem
for me.

I tried the System.Web.Mail method and that works fine - but I would prefer
that on the click of a button a new mail message window opens with the
attachement and the user then inputs what they want and then click on send.
Rather then a message being sent in the back ground with no user interaction
which is the case of the System.Web.Mail .

I feel i am getting close to the solution.....th ought it would be easier
though!

Thanks

"DeveloperX " wrote:
On 4 Jan, 13:59, JimJob <Jim...@discuss ions.microsoft. comwrote:
Thanks developer - but no joy. I have also tried @ C:\ or C:/ to no avail

"DeveloperX " wrote:
On 4 Jan, 11:44, JimJob <Jim...@discuss ions.microsoft. comwrote:
Hi All,
I am using c# to build an application. I want a button that will be able to
open a new mail message with an attachment. The new mail message works but I
can't get the attachment to work - there is no error message just no
attachment. Any ideas? Code i am using is;
System.Diagnost ics.Process.Sta rt("mailto:em.. .@email.com?sub ject=Software&b ody=see attachment&atta chment=c:/myview.mht");
Thanks
try c:\ and prefix the string with an @
ie
(@"mailto:em... @email.com?subj ect=Software&bo dy=see
attachment&atta chment=c:\myvie w.mht"
@ will stop the compiler treating \ as an escape character.- Hide quoted text -
- Show quoted text -

Ignacio appears to be correct, my apologies. You could always add a
reference to System.Web.Mail and use the classes in there. having a
quick poke, I got:

using System.Web.Mail ;
MailMessage message = new MailMessage();
message.From = "pe****@place.c om";
message.Body = "body";
message.To ="anotherpe**** @place.com";
message.Subject = "subject";
message.Attachm ents.Add(new MailAttachment( @"C:\boot.ini") );
SmtpMail.SmtpSe rver = "smtp.mailserve r.com";
SmtpMail.Send(m essage);

should do it, but if you get a "CDO.messag e not found" message that's
to do with authentication. (I got that error, there seem to be alot of
posts about it!)
alternatively I managed to get this to work using outlook interop, but
again, outlook now has all that cruddy security so it pops up a dialog
saying is this ok?? I'm sure I've read about ways of disabling that,
but it was a while ago.

using Microsoft.Offic e.Interop.Outlo ok;
Microsoft.Offic e.Interop.Outlo ok.Application app =
new Microsoft.Offic e.Interop.Outlo ok.ApplicationC lass();
MailItem message = (MailItem)app.C reateItem(OlIte mType.olMailIte m);

Recipient recip =
(Recipient)mess age.Recipients. Add("pe****@pla ce.com");
recip.Resolve() ;

message.Body = "body";
message.Subject = "subject";
message.Attachm ents.Add(@"C:\b oot.ini",
OlAttachmentTyp e.olByValue,mes sage.Body.Lengt h + 1, "an attachment");
//message.Save();
//message.Display (false);
message.Send();
probably no help, but you never know.
Jan 4 '08 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
3301
by: Daniel Reber | last post by:
I am trying to start a process from a windows service but when the process starts the command window that the process runs in never shows. Is this because I am calling it from a windows service? Is there something else that I need to do? Here is my code: System.Diagnostics.ProcessStartInfo info = new System.Diagnostics.ProcessStartInfo();
0
1746
by: marccruz | last post by:
Given an instance of System.Diagnostics.Process, how can I get the parent process o Given an instance of System.Diagnostics.Process, how can I get the child processes For example, I start a process which executes a script that starts a java program System.Diagnostics.Process proc = System.Diagnostics.Process() proc.StartInfo.FileName = "test.bat"
1
5994
by: solex | last post by:
Hello All, Hopefully someone has run into this error. I have written a class(source below) that launches a thread to monitor the StandardOutput of a System.Diagnostics.Process, in particular I am executing the find.exe program. The application works perfectly in the development environment. As soon as I execute the compiled program and start the find process I get an "Application Error". The error states that the instruction...
2
15477
by: andreas | last post by:
hi, In windows xp in the start launch menu when i put notepad "c:\test.txt" i get notepad with test.txt in it. in vb.net when i state system.diagnostics.process.start("notepad.exe" i get notepad but
11
3756
by: Nurit N | last post by:
This is the third newsgroup that I'm posting my problem. I'm sorry for the multiple posts but the matter becoming urgent. I hope this is the right place for it... I have created a very simple batch file (echo hello world) and was trying to retrieve the standard output but every time I run the code it returns ExitCode as 1.
2
5008
by: Daniel | last post by:
System.Diagnostics.Process.Start fails on windows server 2003 the process returns process.ExitCode == 0 but executing any process with System.Diagnostics.Process.Start on windows xp works fine. anything to do different for windows server 2003? some special permission for the process that executes another executable with System.Diagnostics.Process.Start ?? here is the code:
0
849
by: Daniel | last post by:
C# windows service freezes on System.Diagnostics.Process.Start(info) When I launch PSCP from a C# windows service and launch pscp 0.53 there are no issues. but when I use C# windows service to launch pscp 0.58 C# freezes in System.Diagnostics.Process.Start(info)? pscp 0.58 works fine at command line, but causes C# to freeze on ystem.Diagnostics.Process.Start(info) also i noticed that the pscp process does not show in taske manager while...
0
4223
by: Colin Williams | last post by:
I am using the code below to map network drive and then fire up an app in a sub dir of that drive. However when using the file open dialog from that app, drive K: appears just as Network drive K: (this could confuse users) rather than showing the path it is mapped to like in explorer. Using a batch file to execute these commands works great. Any ideas? System.Diagnostics.Process.Start("net.exe", "use K:...
2
6880
by: test3 | last post by:
Hello folks, I'm using System.Diagnostics.Process to start a thirdparty program (that works perfectly when started via command line). I'm using Process.StandardOutput to get the output of the program. That works for 95 %, but the other 5 % it doesn't. It seems to me that the started process just hangs, and therefor my program hangs, too (p.WaitForExit()). I researched that this only happens when the output of the program is longer than...
6
10543
by: kimiraikkonen | last post by:
Hello, I want to ask this: If i do: System.Diagnostics.Process.Start("c:\lame", "--preset standard c:\blabla.wav c:\blabla.mp3") it works. But i don't want this. I want my 2 textboxes must take place as variable like: System.Diagnostics.Process.Start("c:\lame", "--preset standard textbox1" textbox1.text + textbox2.text). But that doesn't work. Meanwhile textboxes are the
0
9511
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10408
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9983
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9020
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7529
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6768
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
1
4092
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3697
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2909
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.