How to send am Email using c# ?

Please support our C# advertiser: Intel Parallel Studio Home
Reply

Join Date: Jul 2007
Posts: 17
Reputation: 1qaz2wsx7 is an unknown quantity at this point 
Solved Threads: 0
1qaz2wsx7 1qaz2wsx7 is offline Offline
Newbie Poster

How to send am Email using c# ?

 
0
  #1
Aug 7th, 2007
Hi

I want to click on a button and open the mail
box so i can put message and send it, how
can i do that ?

Thanks.
Reply With Quote Quick reply to this message  
Join Date: Jun 2007
Posts: 322
Reputation: Hamrick will become famous soon enough Hamrick will become famous soon enough 
Solved Threads: 33
Hamrick's Avatar
Hamrick Hamrick is offline Offline
Posting Whiz

Re: How to send am Email using c# ?

 
0
  #2
Aug 12th, 2007
If by mail box you mean an email application like outlook, you can use the Process class from System.Diagnostics.
  1. System.Diagnostics.Process.Start( "outlook.exe" );
The truth does not change according to our ability to stomach it.
Reply With Quote Quick reply to this message  
Join Date: Jul 2007
Posts: 17
Reputation: 1qaz2wsx7 is an unknown quantity at this point 
Solved Threads: 0
1qaz2wsx7 1qaz2wsx7 is offline Offline
Newbie Poster

Re: How to send am Email using c# ?

 
0
  #3
Aug 13th, 2007
Hi

Thanks for the answer, but i want it to directly go
to a new message and automaticly insert an email
that i choose and let me write a message and send it.

How can i do that ?

Thanks.
Last edited by 1qaz2wsx7; Aug 13th, 2007 at 6:03 am.
Reply With Quote Quick reply to this message  
Join Date: Jun 2007
Posts: 322
Reputation: Hamrick will become famous soon enough Hamrick will become famous soon enough 
Solved Threads: 33
Hamrick's Avatar
Hamrick Hamrick is offline Offline
Posting Whiz

Re: How to send am Email using c# ?

 
0
  #4
Aug 13th, 2007
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
  1. System.Diagnostics.Process.Start( "outlook.exe /newmessage" );
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.
The truth does not change according to our ability to stomach it.
Reply With Quote Quick reply to this message  
Join Date: Aug 2007
Posts: 72
Reputation: zmariow is an unknown quantity at this point 
Solved Threads: 1
zmariow's Avatar
zmariow zmariow is offline Offline
Junior Poster in Training

Re: How to send am Email using c# ?

 
0
  #5
Aug 21st, 2007
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.
Reply With Quote Quick reply to this message  
Join Date: Oct 2007
Posts: 172
Reputation: Jugortha is an unknown quantity at this point 
Solved Threads: 16
Jugortha Jugortha is offline Offline
Junior Poster

Re: How to send am Email using c# ?

 
0
  #6
Dec 23rd, 2007
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");
}
Reply With Quote Quick reply to this message  
Join Date: Apr 2006
Posts: 88
Reputation: blacklocist is an unknown quantity at this point 
Solved Threads: 2
blacklocist blacklocist is offline Offline
Junior Poster in Training

Re: How to send am Email using c# ?

 
0
  #7
Dec 30th, 2007
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
Reply With Quote Quick reply to this message  
Join Date: Feb 2007
Posts: 1,603
Reputation: scru has a spectacular aura about scru has a spectacular aura about 
Solved Threads: 130
Featured Poster
scru's Avatar
scru scru is offline Offline
Posting Virtuoso

Re: How to send am Email using c# ?

 
0
  #8
Dec 30th, 2007
WOw this is an old thread, but it is possible to launch the default email program with a new message window wih this code:

  1. System.Diagnostics.Process.Start("mailto:foo@bar.info");
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
Reply With Quote Quick reply to this message  
Join Date: Dec 2003
Posts: 2,414
Reputation: alc6379 has a spectacular aura about alc6379 has a spectacular aura about alc6379 has a spectacular aura about 
Solved Threads: 123
Team Colleague
alc6379's Avatar
alc6379 alc6379 is offline Offline
Cookie... That's it

Re: How to send am Email using c# ?

 
0
  #9
Dec 30th, 2007
you can use the mailto: syntax to fill in the email in its entirety. It's throughly documented in the RFC822 standard...
Alex Cavnar, aka alc6379
Reply With Quote Quick reply to this message  
Join Date: Dec 2008
Posts: 1
Reputation: gareeb is an unknown quantity at this point 
Solved Threads: 0
gareeb gareeb is offline Offline
Newbie Poster

Re: How to send am Email using c# ?

 
0
  #10
Dec 22nd, 2008
Originally Posted by 1qaz2wsx7 View Post
Hi

I want to click on a button and open the mail
box so i can put message and send it, how
can i do that ?

Thanks.
hi
hw r u? i m fine well. im studying here.what r u doing?
Reply With Quote Quick reply to this message  
Reply

Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC