- Регистрация
- 04.03.2019
- Сообщения
- 234
- Благодарностей
- 42
- Баллы
- 28
GitHub - jstedfast/MailKit: A cross-platform .NET library for IMAP, POP3, and SMTP.
A cross-platform .NET library for IMAP, POP3, and SMTP. - jstedfast/MailKit


SmtpClient.Credentials Property (System.Net.Mail) | Microsoft Learn
Gets or sets the credentials used to authenticate the sender.
docs.microsoft.com
absolutely newbie with c#, how can I use default SMTPclient?
I tried smt like that:
string server= "smtp.aol.com";
int port = 465;
public static void CreateTestMessage1(string server, int port)
{
string to = "[email protected]";
string from = "[email protected]";
string subject = "Using the new SMTP client.";
string body = @"Using this new feature, you can send an email message from an application very easily.";
MailMessage message = new MailMessage(from, to, subject, body);
SmtpClient client = new SmtpClient(server, port);
// Credentials are necessary if the server requires the client
// to authenticate before it will send email on the client's behalf.
client.Credentials = CredentialCache.DefaultNetworkCredentials;
client.Send(message);
}
But can't understand how I use my credential, what's var I need to use?
And I recieve a error about first line...

"
Compiling code Error in action "CS1513" "expected }". [Line: 1; Column: 16]" "