1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
|
using System.Net.Mail;
string strBetreff = "Betreff";
string strNachricht = "Inhalt der Mail";
string strVon = "User@domain.de";
string strAn = "User@domain.de";
string strSmtpServer = "mail.domain.de";
string strUser = "User";
string strPasswort = "xxx";
MailMessage mail = new MailMessage();
MailAddress from = new MailAddress(strVon);
mail.To.Add(strAn);
mail.From = from;
mail.Subject = strBetreff;
mail.Body = strNachricht;
string host = strSmtpServer;
int port = 25;
SmtpClient client = new SmtpClient(host, port);
System.Net.NetworkCredential nc = new System.Net.NetworkCredential(strUser, strPasswort );
client.Credentials = nc;
client.Send(mail);
|