|
Idiots that don't understand and need to be spoon fed.
|
|
|
|
|
it is not working on client. only useful for local machine.
|
|
|
|
|
Hi,
I have used Process Class to start a client machine's outlook new message with pre filled data.but i could not,it is not getting opened in client machine when i uploaded it to server,but it is working in my machine when i run it in my local machine.
Please suggest me how to use this process.start in a buton click of the asp.net
Here is the Code i used to run.
Process process = new Process();
process.StartInfo.FileName = "mailto:" + "accesscontrol@sample.com" + "?subject=" + "Access for Tower 1 and 2 entrance and common area and Kiosk" + "&cc=" + "sampleMailcc@sample.com" + "&body=" + "This is Sample body";
process.Start();
Thanks in Advance
Vijay
modified on Friday, July 4, 2008 12:09 AM
|
|
|
|
|
can anyone tell me how to open outlook with default fields filled(to,cc,body,subject) on click of ASP:Button click
|
|
|
|
|
private void OpenDefaultClient()
{
StringBuilder emailBuilder = new StringBuilder();
emailBuilder.Append("mailto:melroy@testmail.com");
emailBuilder.Append("&cc=testcc@testcc.com,testcc1@testcc.com");
emailBuilder.Append("&bcc=testcc@testbcc.com,testcc1@testbcc.com");
emailBuilder.Append("&subject=this is test subject");
emailBuilder.Append("&body=this is test body");
emailBuilder.Append("&Attach=\"E:\\moonlightshadow.txt\"");
//emailBuilder.Append("&attachment=\"E:\\moonlightshadow.txt\"");
ExecuteFile(emailBuilder.ToString());
}
private void ExecuteFile(string fileName)
{
Process myProcess = new Process();
myProcess.StartInfo.FileName = fileName;
myProcess.StartInfo.UseShellExecute = true;
myProcess.StartInfo.RedirectStandardOutput = false;
myProcess.Start();
myProcess.Dispose();
}
I got this error:
The command line argument is not valid. Vertify the switch you are using.
|
|
|
|
|
Hi guys,
I found a great solution. it's here.
|
|
|
|
|
Please mind, that the total lentght of the string couldn't be more than 1024, the rest is truncated, so this is not sutable for long messages.
|
|
|
|
|
Anyone found a solution for this limitation?
|
|
|
|
|
when the body string contains a carriage return it is ignored
for example
MsgBuilder.Append("&body=this is test body line 1" & vbcrlf & "this is test body line 2")
will generate a email that reads:
this is test body line 1this is test body line 2
without the cr between the two lines.
Is there any way around this?
Thanks
|
|
|
|
|
never mind I found the solution , it is:
MsgBuilder.Append("&body=this is test body line 1 %0D%0A this is test body line 2")
however there seems to be a maximum lenght to the value assigned to the &body parm
Rob
|
|
|
|
|
Thank you Rob, I tried several solutions but none worked, until I stumbled onto your answer. By the way, where did you find this solution?
|
|
|
|
|
For attachment to work, escape the double quote as below. this code is in C#
MsgBuilder.Append("&Attach=\"c:\\mailattach.txt\"")
Also instead for using System.Diagnostics.Process class, there is a simpler and faster way to open default mail client. code below.
Help.ShowHelp (this, MsgBuilder.TosString ());
here paramaeter 'this' represents a Widows Control (Form, textbox etc.).
Regards,
Srinivasan R
|
|
|
|
|
Thanks for this example of code.
Now I just tried this, but for the Lotus Notes mail client
it doesn't start with attachment txt-file.
Do you have any ideas, what I can change?
Thanks!
Kind Regards
Daniel
|
|
|
|
|
Hi Everybody !
The above example code has an error in the line of the attachment command:
MsgBuilder.Append("&Attach="c:\mailattach.txt")
To get the attachments working, you need a full line like:
mailto:melroy@testmail.com&cc=testcc@testcc.com,testcc1@testcc.com&bcc=testcc@testbcc.com,testcc1@testbcc.com&subject=this is test subject&body=this is test body&Attach="c:\mailattach.txt"
In the example the (") are not set correct. To fill that character (") into a string, use strings.chr(34).
So the right line must be:
MsgBuilder.Append("&Attach=" & Strings.Chr(34) & "c:\mailattach.txt" & Strings.Chr(34))
nice day,
Martin Wolff.
Don't talk about...do the coding.
|
|
|
|
|
Hey, what does that translate to in C#?
|
|
|
|
|
I used your code but still the attachment is not getting into email. Any ideas please
|
|
|
|
|
You can use this way (It's work fine)
System.Diagnostics.ProcessStartInfo psInfo =newSystem.Diagnostics.ProcessStartInfo();
psInfo.Arguments = @"G:\Wi.zip";
psInfo.FileName = @"C:\Program Files\Microsoft Office2003\OFFICE11\OUTLOOK.EXE";
System.Diagnostics.Process.Start(psInfo);
Enjoy
fferdinan
|
|
|
|
|
Hi,
I am invoking my mail client using following piece of code. The code opens the mail client having a subject and a file attached with it.
String strLicensePath = "c:\\rohit.txt";
try {
Runtime.getRuntime().exec(
new String[] {"rundll32", "url.dll,FileProtocolHandler",
"mailto:" + "&subject=" + "TEST_STRING" +
"&attachment=" + "\""+ strLicensePath + "\""}
);
}
catch (Exception ex) {
ex.printStackTrace();
}
The above code works fine on my machine having "Microsoft Outlook 2000 SP-3" installed. But gives following error on machine having
Microsoft Outlook 2002 installed:
"The command line argument is not valid. Verify the switch you are using."
Also, the problem is coming in some of other machines also.
Am I using wrong switches, i.e. arguments??
Or is there any alternative way to achieve the same. Please comment.
|
|
|
|
|
to get it works.
MsgBuilder.Append("&Attach=" & Chr(34) & Chr(34) & Application.StartupPath & "\Data.LHP" & Chr(34) & Chr(34))
simply put 2 double quote.
|
|
|
|
|
Mailto protocol does not support attachments.
See: http://ftp.isi.edu/in-notes/rfc2368.txt
|
|
|
|
|
This feature is seen on pdf documents and they do it very beautifully for all the three default email clients (a) Microsoft Outlook (b) Outlook Express (c) Hotmail. I wish to replicate the same feature in my application.
Regards
-Tej
|
|
|
|
|
if got solution plz fwd me
|
|
|
|