Created
December 15, 2019 18:28
-
-
Save Tempest1000/73ee8e5d533d3bbd6ccc28d4eccfcc3f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<Query Kind="Program" /> | |
void Main() | |
{ | |
string mailServer = "<mail server>"; | |
int port = 25; | |
string mailFrom = "<email address>"; | |
string mailTo = "<email address>"; | |
System.Net.Mail.SmtpClient client = new System.Net.Mail.SmtpClient(mailServer, port); | |
using (System.Net.Mail.MailMessage message = new System.Net.Mail.MailMessage()) | |
{ | |
message.From = new System.Net.Mail.MailAddress(mailFrom); | |
message.To.Add(mailTo); | |
message.Subject = "Test Message"; | |
message.Body = "This is a test message"; | |
try | |
{ | |
client.Send(message); | |
"Success".Dump(); | |
} | |
catch (Exception ex) | |
{ | |
ex.ToString().Dump(); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment