[How To/Public Class][UPE-DEV]Create simple app - send e-mail[Source Code][C#]

Nokser

Inactive Recognized Developer
Mar 18, 2008
3,259
603
0
33
Warsaw
mcodingset.com
Create simple application - send e-mail

Create apps in Visual Studio 2010 or in other version.

Source Code upe-sendemail (button send):
Code:
private void button1_Click(object sender, RoutedEventArgs e)
        {
            // Collect user input from the form and stow content into
            // the objects member variables
            // Within a try catch, format and send the message to
            // the recipient.  Catch and handle any errors.
            try
            {
                EmailComposeTask message = new EmailComposeTask();
                message.Subject = subject;
                message.Body = message;
                message.To = to;
                message.Show();
                MessageBox.Show("Mail Sent");
            }
            catch (OutOfMemoryException ex)
            {
                MessageBox.Show(ex.StackTrace);
            }
        }
Info TextBox:
  • To - e-mail address - the recipient
  • Subject - subject message
  • Message - Text sending message

More Server Address:
  • smtp.gmail.com // Gmail
  • smtp.live.com // Windows live / Hotmail
  • smtp.mail.yahoo.com // Yahoo
  • smtp.aim.com // AIM
  • my.inbox.com // Inbox

It may be useful to someone...
Have Fun!

Mod. thread - more comming soon...

Nokser
 
Last edited:
  • Like
Reactions: pdaimatejam