send e-mail

  • Thread starter Thread starter Hrvoje Voda
  • Start date Start date
H

Hrvoje Voda

I would like to call Microsoft Outlook and put my e-mail address into To: .

All that through code.

Hrcko
 
Hi Hrvoje,

Can you give us a little more information so we can direct a response
better? Are you doing this with ASP, Win forms, Console app, etc...?

If you are using asp try setting a mailto link to something like

<a
href="mailto:p[email protected]&[email protected]&Subject=MySubjectGoesHere?"> Mail! </a>

You may be able to automate this by calling Response.Redirect on that link.
You can take a look at the web page below for more formatting options. If
you are wanting to send it via a different method please reply to this post
answering the questions above.

I hope this helps.
 
Hi Hrvoje

Drop this code into your app

using System.Diagnostics;

string toEmail = "(e-mail address removed)";
string subject = "Love the Program";
string body = "Thanks a lot";
string message = string.Format( "mailto:{0}?subject={1}&body={2}", toEmail,
subject, body );

Process.Start( message );

Add this to a linklabel and bobs your uncle. Take a look at the folliwng
link for a full example
http://www.publicjoe.f9.co.uk/csharp/snip/snip07.html

Hope this helps

Publicjoe

C# Tutorial at http://www.publicjoe.f9.co.uk/csharp/tut.html
C# Ebook at http://www.publicjoe.f9.co.uk/csharp/samples/ebook.html
VB Tutorial at http://www.publicjoe.f9.co.uk/vbnet/vbnet.html
VB Ebook at http://www.publicjoe.f9.co.uk/vbnet/samples/ebook.html
Mirrors at http://www.dowhileloop.com/publicjoe/ and
http://www.publicjoe.justbe.com/

Useful Articles at http://www.madsally.co.uk
 
Hrvoje,

Can you try this one?

///a reference to System.Web
///using System.Web;
///using System.Diagnostic
Process.Start ("mailto:" + HttpUtility.UrlEncode([email protected])
+ "?subject=Does this helps" + "&body=How do you do?");

I hope this helps?

Cor
 
Hi Hrvoje,

Take a look at Cor and PublicJoe's examples they should work for you. If
this is not what you are looking for please reply to this post with more
details so we can help you out better.

Good Luck.
 
Hrcko

This will use the default email client to send email from within your
application. Note that you can extend to include the input parameters to
include BCC and Body of the email.

System.Diagnostics.Process.Start("mailto:[email protected]?cc=yourfriend@
company.com&subject=Testing email " )

Hope this helps
Yonas
 
Back
Top