Never been to TextSnippets before?

Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world (or not, you can keep them private!)

« Newer Snippets
Older Snippets »
5 total  XML / RSS feed 

Authenticated SMTP in C#

// send smtp from from c#/.net

System.Web.Mail.MailMessage message=new System.Web.Mail.MailMessage();

message.Fields.Add( "http://schemas.microsoft.com/cdo/configuration/smtpauthenticate",1 );
message.Fields.Add( "http://schemas.microsoft.com/cdo/configuration/sendusername","SmtpHostUserName" );
message.Fields.Add( "http://schemas.microsoft.com/cdo/configuration/sendpassword","SmtpHostPassword" );

message.From="from e-mail";
message.To="to e-mail";
message.Subject="Message Subject";
message.Body="Message Body";

System.Web.Mail.SmtpMail.SmtpServer="SMTP Server Address";
System.Web.Mail.SmtpMail.Send(message);

private

// description of your code here
http://textsnippets.com/
// insert code here..

Populating a Winforms ComboBox with csharp

private void PoblarComboPais()
{
// Trae las sociedades correspondientes al país
Cursor.Current = Cursors.WaitCursor;
// Conexión
string cn = SqlOptions.ConnectionString();

// DataReader
this.cboPais.DataSource = SqlHelper.ExecuteDataset(cn,CommandType.Text , "SELECT * FROM MAE_PAIS").Tables[0];
this.cboPais.ValueMember = "chrPais";
this.cboPais.DisplayMember = "chrPaisNombre";

//Puntero del mouse normal
Cursor.Current = Cursors.Default;
}

csharp app.path

// csharp app.path

public static string AppPath()
{return AppDomain.CurrentDomain.BaseDirectory;}

Quick Mail class

// Quick Mail class

    static class QuickMail
    {
        public static void SendMail(string from, string to, string subject, string messageText, bool isHtml)
        {
                        SmtpClient mymail = new SmtpClient(ConfigurationManager.AppSettings["localsmtp"]);
                        MailMessage message = new MailMessage(from, to, subject, messageText);
                        message.IsBodyHtml = isHtml;
                        mymail.Send(message);
        }
    }
« Newer Snippets
Older Snippets »
5 total  XML / RSS feed