Download source code

private void btnStart_Click(object sender, EventArgs e) {
    this.watcher.Path = edtQueueFolder.Text;
    this.watcher.EnableRaisingEvents = true;
 
    this.relay.DnsServer = edtDNS.Text;
}
 
private void watcher_Created(object sender, System.IO.FileSystemEventArgs e) {
    lock (this) {
        edtLog.Text += e.Name + "\r\n";
 
        DataStringCollection src = new DataStringCollection();
 
        using (Stream stream = File.OpenRead(e.FullPath)) {
            src.LoadFromStream(stream);
        }
 
        this.relay.Send(src);
 
        foreach (SmtpRelayStatus item in relay.StatusList) {
            edtLog.Text += item.Domain;
            if (item.IsSent) {
                edtLog.Text += " - Sent\r\n";
            }
            else {
                edtLog.Text += " - Error: " + item.ErrorText + "\r\n";
            }
        }
    }
}

Add Feedback