| | |
How to send am Email using c# ?
Please support our C# advertiser: Intel Parallel Studio Home
![]() |
If by mail box you mean an email application like outlook, you can use the Process class from System.Diagnostics.
C# Syntax (Toggle Plain Text)
System.Diagnostics.Process.Start( "outlook.exe" );
The truth does not change according to our ability to stomach it.
I'm not sure you can do that with outlook, but I'd start by seeing if there's a command line switch I could use. Something like
You're probably asking too much for a simple solution and the best way to solve the problem would be to write your own mail handler instead of calling an existing one.
c# Syntax (Toggle Plain Text)
System.Diagnostics.Process.Start( "outlook.exe /newmessage" );
The truth does not change according to our ability to stomach it.
You might want to try the HTML mailto syntax.
For example: <a href="mailto:email@test.com?body=I am having trouble finding information on... ">email me></a>
Clicking on the above link will open your default email handler with message already started in Body. (Check this page for more examples http://www.ianr.unl.edu/internet/mailto.html)
Now you have to see how to integrate HTML into your application.
Good luck.
For example: <a href="mailto:email@test.com?body=I am having trouble finding information on... ">email me></a>
Clicking on the above link will open your default email handler with message already started in Body. (Check this page for more examples http://www.ianr.unl.edu/internet/mailto.html)
Now you have to see how to integrate HTML into your application.
Good luck.
•
•
Join Date: Oct 2007
Posts: 172
Reputation:
Solved Threads: 16
I give u a brief peace of code
First u must include
using System.Net.Mail;
//Initialize an SMTP client
SmtpClient objSmtpClient = new SmtpClient();
MailMessage objMail = new MailMessage();
// Precise the mail adress sender and reciever
MailAdress oSenderAdress = new MailAdress("dsd@dsdd.fd");
MailAdress oRecieverAdress = new MailAdress("sdsd@dsdsd.fd");
//Parameter the objMail
objMail.From = oSenderAdress;
objMail.To = oRecieverAdress;
//To send the email u can use the method
try{
objSmtpClient.send(objMail);
}
catch(Exception caught)
{ Response.Redirect("http://www.yourWebSite/ErrorPage.asp");
}
First u must include
using System.Net.Mail;
//Initialize an SMTP client
SmtpClient objSmtpClient = new SmtpClient();
MailMessage objMail = new MailMessage();
// Precise the mail adress sender and reciever
MailAdress oSenderAdress = new MailAdress("dsd@dsdd.fd");
MailAdress oRecieverAdress = new MailAdress("sdsd@dsdsd.fd");
//Parameter the objMail
objMail.From = oSenderAdress;
objMail.To = oRecieverAdress;
//To send the email u can use the method
try{
objSmtpClient.send(objMail);
}
catch(Exception caught)
{ Response.Redirect("http://www.yourWebSite/ErrorPage.asp");
}
•
•
Join Date: Apr 2006
Posts: 88
Reputation:
Solved Threads: 2
I have actually seen what 1qaz2wsx7 is talking about. It's actually pretty cool. I first saw it at work when a end user needed some help. She was using a Access DB that on one of the forms would actually open up Lotus Notes and fill in the Recipient, Subject and Body.
On a windows machines it uses the default email program that I think can be set int Internet Options -> Programs-> Email setting.
My 2 Cents
On a windows machines it uses the default email program that I think can be set int Internet Options -> Programs-> Email setting.
My 2 Cents
WOw this is an old thread, but it is possible to launch the default email program with a new message window wih this code:
the when Windows sees the mailto protocol it opens the associated program. The program will open a new message page only (Well that's what Windows Mail and Outlook did on my Vista system). You can change the mailto arguments. See: http://www.ianr.unl.edu/internet/mailto.html
C# Syntax (Toggle Plain Text)
System.Diagnostics.Process.Start("mailto:foo@bar.info");
![]() |
Similar Threads
- Can't send email (Windows NT / 2000 / XP)
- unable to upload files or send email on wireless (Windows NT / 2000 / XP)
- Cannot Upload files or send email on wireless (Web Browsers)
- Using PHP to Send Email to a single DB list member every 24 hrs. (PHP)
- Batch file to send email!! (Windows NT / 2000 / XP)
- Not able to send email by "MAIL" (OS X)
- can not send email and cannot send file through instant messaging (Windows NT / 2000 / XP)
Other Threads in the C# Forum
- Previous Thread: Problem with 2 forms working together.
- Next Thread: {System.Runtime.InteropServices.ExternalException} = Array index out of bounds
| Thread Tools | Search this Thread |
.net access algorithm angle array barchart bitmap box broadcast c# capturing check checkbox client combobox control conversion convert csharp custom database datagrid datagridview dataset datetime dbconnection degrees delegate design development disappear draganddrop drawing encryption enum event excel file firefox form format forms function gdi+ httpwebrequest image index input install java label leak libraries list listbox mandelbrot math monodevelop mouseclick msword mysql operator path pause photoshop picturebox pixelinversion post programming radians regex remote remoting richtextbox round server sleep socket sql statistics stream string table tcpclientchannel text textbox thread time timer update usercontrol validation virtualization visualbasic visualstudio webbrowser windows winforms wpf xml







