User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the C# section within the Software Development category of DaniWeb, a massive community of 402,519 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 2,718 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our C# advertiser: Programming Forums
Views: 5180 | Replies: 8
Reply
Join Date: Jul 2007
Posts: 17
Reputation: 1qaz2wsx7 is an unknown quantity at this point 
Rep Power: 2
Solved Threads: 0
1qaz2wsx7 1qaz2wsx7 is offline Offline
Newbie Poster

How to send am Email using c# ?

  #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.
AddThis Social Bookmark Button
Reply With Quote  
Join Date: Jun 2007
Posts: 321
Reputation: Hamrick will become famous soon enough Hamrick will become famous soon enough 
Rep Power: 3
Solved Threads: 33
Hamrick's Avatar
Hamrick Hamrick is offline Offline
Posting Whiz

Re: How to send am Email using c# ?

  #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  
Join Date: Jul 2007
Posts: 17
Reputation: 1qaz2wsx7 is an unknown quantity at this point 
Rep Power: 2
Solved Threads: 0
1qaz2wsx7 1qaz2wsx7 is offline Offline
Newbie Poster

Re: How to send am Email using c# ?

  #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 5:03 am.
Reply With Quote  
Join Date: Jun 2007
Posts: 321
Reputation: Hamrick will become famous soon enough Hamrick will become famous soon enough 
Rep Power: 3
Solved Threads: 33
Hamrick's Avatar
Hamrick Hamrick is offline Offline
Posting Whiz

Re: How to send am Email using c# ?

  #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  
Join Date: Aug 2007
Posts: 70
Reputation: zmariow is an unknown quantity at this point 
Rep Power: 2
Solved Threads: 1
zmariow's Avatar
zmariow zmariow is offline Offline
Junior Poster in Training

Re: How to send am Email using c# ?

  #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  
Join Date: Oct 2007
Posts: 92
Reputation: Jugortha is an unknown quantity at this point 
Rep Power: 1
Solved Threads: 8
Jugortha Jugortha is offline Offline
Junior Poster in Training

Re: How to send am Email using c# ?

  #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  
Join Date: Apr 2006
Posts: 87
Reputation: blacklocist is an unknown quantity at this point 
Rep Power: 3
Solved Threads: 2
blacklocist blacklocist is offline Offline
Junior Poster in Training

Re: How to send am Email using c# ?

  #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  
Join Date: Feb 2007
Location: St. Vincent and the Grenadines, Caribbean
Posts: 961
Reputation: scru is an unknown quantity at this point 
Rep Power: 3
Solved Threads: 39
Featured Poster
scru's Avatar
scru scru is offline Offline
Posting Shark

Re: How to send am Email using c# ?

  #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
Half and a half meck a whole, and I donned it a hundrid purcent
Reply With Quote  
Join Date: Dec 2003
Location: Nashville, TN
Posts: 2,333
Reputation: alc6379 has a spectacular aura about alc6379 has a spectacular aura about alc6379 has a spectacular aura about 
Rep Power: 11
Solved Threads: 101
Colleague
alc6379's Avatar
alc6379 alc6379 is offline Offline
Cookie... That's it

Re: How to send am Email using c# ?

  #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  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.

DaniWeb C# Marketplace
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

Thread Tools Display Modes

Similar Threads
Other Threads in the C# Forum

All times are GMT -4. The time now is 6:29 pm.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC