Ajax
ASP
C,C++
C#,.NET
CSS,HTML
Delphi,Kylix
Experience
Flash
Java
JavaScript
PHP
Python
QT
SQL
ShellScript
VB
U :
P :
Register
Lost Password
Other Links
Code Archive
Save Giovanni
C#,.NET Category Code
Real Name
:
SharingCode.NET User
Subject
:
Sending Authenticated Emails in .NET 2.0
Description
:
Sending Authenticated Emails in .NET 2.0 - src: developerfusion.co.uk
MailMessage oMsg = new MailMessage(); // Set the message sender oMsg.From = new MailAddress("xavier@devel.oping.net", "Xavier Larrea"); // The .To property is a generic collection, // so we can add as many recipients as we like. oMsg.To.Add(new MailAddress("fox@foxcorp.org","John Doe")); // Set the content oMsg.Subject = "My First .NET email"; oMsg.Body = "Test body - .NET Rocks!"; oMsg.IsBodyHtml = true; SmtpClient oSmtp = new SmtpClient("smtp.myserver.com"); //You can choose several delivery methods. //Here we will use direct network delivery. oSmtp.DeliveryMethod = SmtpDeliveryMethod.Network; //Some SMTP server will require that you first //authenticate against the server. NetworkCredential oCredential = new NetworkCredential("myusername","mypassword"); oSmtp.UseDefaultCredentials = false; oSmtp.Credentials = oCredential; //Let's send it already oSmtp.Send(oMsg);
Rating
:
0.00
(out of 5)
Visitor Voting Booth
:
Excellent
Very Good
Good
Fair
Poor
Copyright © 2006 SharingCode.NET . All rights reserved. Hosted By: SisNetworks