944,162 Members | Top Members by Rank

Ad:
  • C# Discussion Thread
  • Unsolved
  • Views: 34617
  • C# RSS
You are currently viewing page 1 of this multi-page discussion thread
Aug 7th, 2007
0

How to send am Email using c# ?

Expand 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.
Similar Threads
Reputation Points: 10
Solved Threads: 0
Newbie Poster
1qaz2wsx7 is offline Offline
17 posts
since Jul 2007
Aug 12th, 2007
0

Re: How to send am Email using c# ?

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)
  1. System.Diagnostics.Process.Start( "outlook.exe" );
Reputation Points: 180
Solved Threads: 34
Posting Whiz
Hamrick is offline Offline
322 posts
since Jun 2007
Aug 13th, 2007
0

Re: How to send am Email using c# ?

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.
Reputation Points: 10
Solved Threads: 0
Newbie Poster
1qaz2wsx7 is offline Offline
17 posts
since Jul 2007
Aug 13th, 2007
0

Re: How to send am Email using c# ?

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
c# Syntax (Toggle Plain Text)
  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.
Reputation Points: 180
Solved Threads: 34
Posting Whiz
Hamrick is offline Offline
322 posts
since Jun 2007
Aug 21st, 2007
0

Re: How to send am Email using c# ?

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.
Reputation Points: 14
Solved Threads: 1
Junior Poster in Training
zmariow is offline Offline
69 posts
since Aug 2007
Dec 23rd, 2007
0

Re: How to send am Email using c# ?

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");
}
Reputation Points: 11
Solved Threads: 16
Junior Poster
Jugortha is offline Offline
172 posts
since Oct 2007
Dec 30th, 2007
0

Re: How to send am Email using c# ?

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
Reputation Points: 10
Solved Threads: 2
Junior Poster in Training
blacklocist is offline Offline
87 posts
since Apr 2006
Dec 30th, 2007
0

Re: How to send am Email using c# ?

WOw this is an old thread, but it is possible to launch the default email program with a new message window wih this code:

C# Syntax (Toggle Plain Text)
  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
Featured Poster
Reputation Points: 975
Solved Threads: 140
Posting Virtuoso
scru is offline Offline
1,624 posts
since Feb 2007
Dec 30th, 2007
0

Re: How to send am Email using c# ?

you can use the mailto: syntax to fill in the email in its entirety. It's throughly documented in the RFC822 standard...
Team Colleague
Reputation Points: 186
Solved Threads: 147
Cookie... That's it
alc6379 is offline Offline
2,519 posts
since Dec 2003
Dec 22nd, 2008
0

Re: How to send am Email using c# ?

Click to Expand / Collapse  Quote originally posted by 1qaz2wsx7 ...
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?
Reputation Points: 10
Solved Threads: 0
Newbie Poster
gareeb is offline Offline
1 posts
since Dec 2008

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC