Created
October 8, 2015 19:26
-
-
Save brunomlopes/9e00e87e56902abd8cae to your computer and use it in GitHub Desktop.
Scriptcs file to send a bunch of .eml files
This file contains hidden or 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
/* | |
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