Skip to content

Instantly share code, notes, and snippets.

@RyannosaurusRex
Created November 6, 2015 18:28
Show Gist options
  • Save RyannosaurusRex/8b6a704dadac0c1799a8 to your computer and use it in GitHub Desktop.
Save RyannosaurusRex/8b6a704dadac0c1799a8 to your computer and use it in GitHub Desktop.
Send an email using ScriptCS
// 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