Created
November 6, 2015 18:28
-
-
Save RyannosaurusRex/8b6a704dadac0c1799a8 to your computer and use it in GitHub Desktop.
Send an email using ScriptCS
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
// This script sends an email using ScriptCS. | |
// Useful as an isolated, easy to configure email sender to debug SMTP | |
// issues that may be hard/impossible by running your production application | |
// over and over just to send an email. | |
// More Info: http://scriptcs.net/ | |
using System.Net.Mail; | |
string from = "[email protected]"; | |
string to = "[email protected]"; | |
string subject = "Test Email"; | |
string body = "This is a test email sent from ScriptCS!"; | |
MailMessage message = new MailMessage(from, to, subject, body); | |
var client = new SmtpClient("smtp.mydomain.com", 25); | |
client.Send(message); | |
Console.WriteLine("Email sent!"); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment