Skip to content

Instantly share code, notes, and snippets.

@brunomlopes
Created October 8, 2015 19:26
Show Gist options
  • Save brunomlopes/9e00e87e56902abd8cae to your computer and use it in GitHub Desktop.
Save brunomlopes/9e00e87e56902abd8cae to your computer and use it in GitHub Desktop.
Scriptcs file to send a bunch of .eml files
/*
Run
> scriptcs -install Lumisoft.Net.dll
To install Lumisoft.net
*/
using LumiSoft.Net;
using System.IO;
using System.Linq;
using LumiSoft.Net.SMTP.Client;
public class SendMails {
public static LumiSoft.Net.SMTP.Client.SMTP_Client client ;
public static void Run(){
var path = string.Empty; // TODO: fill out path
var files = System.IO.Directory.EnumerateFiles(path)
.Where(e => e.EndsWith(".eml")).ToList();
foreach(var file in files){
var message = LumiSoft.Net.Mail.Mail_Message.ParseFromFile(file);
System.Console.WriteLine("Sending email :"+ message.Subject);
SMTP_Client.QuickSendSmartHost("localhost", "localhost", 2525 , false, "fakeuser","fakepassword", message);
}
System.Console.WriteLine(string.Format("Done, {0} files", files.Count));
}
}
SendMails.Run();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment