• Stars
    star
    143
  • Rank 257,007 (Top 6 %)
  • Language
    C#
  • License
    MIT License
  • Created over 6 years ago
  • Updated 12 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Smtp server for mass emailing, managing email lists and more. Built on .NET Core. Linux, MAC and Windows compatible.

& Mail Demon &

Mail Demon is a simple and lightweight C# smtp server and mail list system for sending unlimited emails and text messages. With a focus on simplicity, async and performance, you'll be able to easily send thousands of messages per second even on a cheap Linux VPS. Memory usage and CPU usage are optimized to the max. Security and spam prevention is also built in using SPF validation.

Mail Demon requires .NET 6.0+ runtime installed, or you can build a stand-alone executable to remove this dependancy.

Make sure to set appsettings.json to your required parameters before attempting to use.

Thanks to MimeKit and MailKit for their tremendous codebase.

Mail Demon is great for sending notifications, announcements and even text messages. See SMS Email Gateway for more information on text messages.

IPBan Integration

Mail Demon is integrated with IPBan. If you have installed IPBan on your Linux or Windows box, then Mail Demon will send failed login attempts from SMTP or the mail list login to IPBan via a custom log file, blocking those attackers that exceed the failed login threshold for IPBan.

Project Build Instructions

  • Ensure .NET 6.0 SDK or newer installed.
  • Download code, open in Visual Studio or VS Code, set release configuration.
  • Update appsettings.json with your settings. I recommend an SSL certificate. Lets encrypt is a great option. Make sure to set the users to something other than the default.
  • Right click on project, select 'publish' option.
  • Find the publish folder (right click on project and open in explorer), then browse to bin/release/publish/netcoreapp and make sure it looks good.
  • If you don't want to install .NET core, set your publish profile to "self contained".
  • FTP or copy files to your server.
  • For Windows, use Firedaemon and set the command to run your .dll or .exe from your publish step.
  • For Linux setup a service (put binaries in /opt/MailDemon):
sudo nano /lib/systemd/system/MailDemon.service
[Unit]
Description=Mail Demon Service
After=network.target

[Service]
WorkingDirectory=/opt/MailDemon
ExecStart=/usr/bin/dotnet /opt/MailDemon/MailDemon.dll
Restart=on-failure

[Install]
WantedBy=multi-user.target
sudo systemctl daemon-reload 
sudo systemctl enable MailDemon
sudo systemctl start MailDemon
systemctl status MailDemon

Smtp Setup Instructions

Supported smtp extensions:

  • 250-SIZE
  • 250-8BITMIME
  • 250-AUTH PLAIN
  • 250-PIPELINING
  • 250-ENHANCEDSTATUSCODES
  • 250-BINARYMIME
  • 250-CHUNKING
  • 250-STARTTLS
  • 250 SMTPUTF8

Known Issues:

  • Hotmail.com, live.com and outlook.com have had an invalid SSL certificate for quite a while now. I've added them to appsettings.json. You may need to add additional entries for mail services with bad certificates.

Mail List Setup

Mail Demon contains an integrated mail list management website and mail list sending service. In order to use this service, you must setup your appsettings.json file and make some additional optional customization.

  • Make sure your smtp settings are correct in appsettings.json.
  • Setup appsettings.json, mailDemonWeb section.
  • Use --server.urls parameter to set the kestrel binding for the web server.
  • Login with https://yourdomain.com/MailDemonLogin. Replace yourdomain.com with your actual domain name. Use the admin user/password from the appsettings.json file. Nothing will show up until you login.
  • Create a new mailing list using menu at top.
  • List name is meant to be more like a short variable name, somewhat human readable, but short and unique. List title is what subscribers will see.
  • Send your victims, I mean subscribers, to https://yourdomain.com/SubscribeInitial/[listname]. Replace yourdomain.com with your actual domain name. Replace [listname] with the actual list name.
  • Create new templates by selecting lists at the top, then using create template button.
  • The template name format is [listName]@[templateName] (without brackets). Just like lists, the template name is a short, human readable and unique name.
  • The template title is NOT the subject of the email, it is just informational for you only.
  • Full razor syntax, @Html, etc. is supported. The model for the templates is the MailListSubscription class.
  • Feel free to create and edit templates in visual studio and then paste them into the template text box.
  • Each template should have a layout. A layout is a template that you will never email, it just wraps other templates. You can name your layout [listName]@[layoutName] (without brackets). You can start with _LayoutMail.cshtml and customize and provide your own css link. You should also provide an unsubscribe link, along with a physical mailing address to comply with anti-spam laws.
  • Set the layout of your template like this: @{ Layout = "listName@layoutName"; }
  • To set the email subject, add a <!-- Subject: ... --> to the body of your template, it will then be set as the email subject. This is required in order to send email. See SubscribeConfirmDefault.cshtml for an example.
  • To bulk send email from a mail list, select (or create) the template from the list to send, edit it, add your subject and save. Then use the send button to perform the bulk email operation. Errors will be logged.
  • There are three magic template names that can override the default behavior for a list:
    • SubscribeInitial (see SubscribeInitialDefault.cshtml). This is the initial sign-up form.
    • SubscribeConfirm (see SubscribeConfirmDefault.cshtml). This is the confirmation email with a link to activate the subscription.
    • SubscribeWelcome (see SubscribeWelcomeDefault.cshtml). This is the welcome email to notify of the active subscription, along with an unsubscribe link.
  • Note that the MailDemon.db file contains all the lists, templates, subscribers, etc. Backup this file regularly!
  • You can also store your templates in the Views/Shared directory. Follow the same naming convention for a template name

Database

Mail Demon uses sqlite by default. In the appsettings.json file, you can set the DatabaseProvider element to sqlserver and set ConnectionStrings:sqlserver to your sql server connection string if desired.

Enjoy!

--Jeff

More Repositories

1

IPBan

Since 2011, IPBan is the worlds most trusted, free security software to block hackers and botnets. With both Windows and Linux support, IPBan has your dedicated or cloud server protected. Upgrade to IPBan Pro today and get a discount. Learn more at ↓
C#
1,615
star
2

ExchangeSharp

ExchangeSharp is a powerful, fast and easy to use .NET/C# API for interfacing with many crypto currency exchanges. REST and web sockets are supported.
C#
742
star
3

DRColorPicker

Digital Ruby, LLC Color Picker for iOS
Objective-C
75
star
4

FingersGestures

Unity Touch Gestures for iOS, Android, Windows, MAC and any other touch capable platform.
C#
55
star
5

AutoSSH

Simple Windows and Linux automation and backup over SSH using dotnet core
C#
7
star
6

SimpleCache

Simple yet Powerful L1/L2/L3 caching in .NET. Memory -> Local File -> Redis. I am open to suggestions for enhancements, email [email protected].
C#
5
star
7

IPBanProReleases

IPBan Pro Releases
4
star
8

IPBanProSDK

IPBan Pro API and Application Integrations. Learn more at -->
C#
3
star
9

ServiceSpy

Simple Decentralized and Distributed Service Discovery
C#
3
star
10

SimpleDi

Simple, declarative dependency injection and configuration without all the boilerplate. I am open to suggestions for enhancements, email [email protected].
C#
2
star
11

ExitPopup

Simple Exit Popup in vanilla javascript. Got questions or feedback? Send me an email at [email protected].
HTML
2
star
12

SimplePubSub

Declarative and simple pub/sub for .NET using Mass Transit. I am open to suggestions for enhancements, email [email protected].
C#
1
star
13

S3ObjectStore

Allow storing json objects in S3 easily
C#
1
star
14

DigitalRubyCore

Digital Ruby, LLC Core Code for Modern .NET Server Applications
C#
1
star
15

UnityManuals

Manuals for various Digital Ruby, LLC Products
HTML
1
star