-----------------------------------------------------------

New Message on BDOTNET

-----------------------------------------------------------
From: Akshit56491
Message 2 in Discussion

Hi,    check the class code below.   using System;
    using System.Web.Mail;
    namespace myMail
    {
     /// <summary>
     /// Summary description for ClsStartup.
     /// </summary>
     public class ClsMail
     {
      private string mTxtEmailTo; // Emailaddres for user to send
      private string mTxtEmailFrom;// Emailaddres for user from 
      private string mTxtMailSubj;
      private string mTxtMailBody;
      private string mTxtServerName;
      public ClsMail()
      {
       Console.WriteLine ("Console SMTP Mail V0.1");
       Console.WriteLine ("----------------------");
       mTxtEmailFrom = "";
       mTxtEmailTo = "";
      }
      public string SmtpServer
      {
       set
       {
        mTxtServerName = value;
        SmtpMail.SmtpServer = value;
       }
       get
       {
        return mTxtServerName;
       }
      }
      public string EmailFrom 
      {
       set
       {
        mTxtEmailFrom = value;
       }
       get
       {
        return mTxtEmailFrom;
       }
      }
      public string EmailTo
      {
       set
       {
        mTxtEmailTo = value;
       }
       get
       {
        return mTxtEmailTo;
       }
      }
      public string MailBody
      {
       set
       {
        mTxtMailBody = value;
       }
       get
       {
        return mTxtMailBody;
       }
      }
      public string MailSubject
      {
       set
       {
        mTxtMailSubj = value;
       }
       get
       {
        return mTxtMailSubj;
       }
      }
      public bool SendNow()
      {
       try
       {
        Console.WriteLine();
        Console.WriteLine("Connecting to : {0}" , mTxtServerName);
        SmtpMail.Send (mTxtEmailFrom,mTxtEmailTo,mTxtMailSubj,
                mTxtMailBody);
        return true;
       }
       catch (Exception e)
       {
        Console.WriteLine("Error Mail Sending : {0}" , e.Message );
        return false;
       }
      }
      /// <summary>
      /// Startup Method
      /// </summary>
      [STAThread]
      static void Main(string[] args)
      {
       /// Header MainApplication
      ClsMail Smtp = new ClsMail();
      Console.Write("Smtp server : ");
      Smtp.SmtpServer = Console.ReadLine();
      Console.Write("Your Emailaddr : ");
      Smtp.EmailFrom = Console.ReadLine();
      Console.Write("Email To Send : ");
      Smtp.EmailTo = Console.ReadLine();
      Console.Write("Subject Mail : ");
      Smtp.MailSubject = Console.ReadLine();
      Console.Write("Body : ");
      Smtp.MailBody = Console.ReadLine();
       if (Smtp.SendNow())
       {
        Console.WriteLine("End Session : Succesfully");
       }
       else
       {
        Console.WriteLine("End Session : Failed");
       }
      Console.WriteLine("Press any Key");
      Console.Read();
      }
       
     }
    }
   Regards, Akshit

-----------------------------------------------------------

To stop getting this e-mail, or change how often it arrives, go to your E-mail 
Settings.
http://groups.msn.com/bdotnet/_emailsettings.msnw

Need help? If you've forgotten your password, please go to Passport Member Services.
http://groups.msn.com/_passportredir.msnw?ppmprop=help

For other questions or feedback, go to our Contact Us page.
http://groups.msn.com/contact

If you do not want to receive future e-mail from this MSN group, or if you received 
this message by mistake, please click the "Remove" link below. On the pre-addressed 
e-mail message that opens, simply click "Send". Your e-mail address will be deleted 
from this group's mailing list.
mailto:[EMAIL PROTECTED]

Reply via email to