UsingthenewASP.NETv2.0SMTPClass
Due to the fact that
System.Web.Mail.SmtpMail is obsolete now, here's a little Snippet for you which shows the use of the replacement class. You can leave out the SMTPServer stuff if you're Mailserver runs locally and doesn't require local authentication.
using System.Net.Mail;
...
protected void Button1_Click(object sender, EventArgs e)
{
string SMTPServer = "mail.sunlab.de";
string fromAddress = "Andreas.Kraus@sunlab.de";
string fromName = "Andreas Kraus";
string toAddress = "info@kmc-home.com";
string toName = "KMC Studios";
string msgSubject = "Meeting";
string msgBody = "Today";
SmtpClient client = new SmtpClient(SMTPServer);
client.Credentials= new System.Net.NetworkCredential("Andreas.Kraus@sunlab.de", "thepw");
MailAddress from = new MailAddress(fromAddress, fromName);
MailAddress to = new MailAddress(toAddress, toName);
MailMessage message = new MailMessage(from, to);
message.Subject = msgSubject;
message.Body = msgBody;
client.Send(message);
}
Andreas Kraus aka `reteep`
http://www.sunlab.de (2005-5-02:08:28)
| 感谢原创者的辛勤劳动,希望对您有所帮助,转载请注明原出处。 |