How to create a SMTP plugin for ArGoSoft Mail Server,.NET edition (AMS.NET edition) using Visual Studio 2005



Similar documents
Internet and Intranet Protocols and Applications

A Step by Step Guide for Building an Ozeki VoIP SIP Softphone

Getting Started with the Internet Communications Engine

Using ilove SharePoint Web Services Workflow Action

How to use ArGoSoft Mail Server.NET Freeware

EJB 3.0 and IIOP.NET. Table of contents. Stefan Jäger / stefanjaeger@bluewin.ch

SMTP-32 Library. Simple Mail Transfer Protocol Dynamic Link Library for Microsoft Windows. Version 5.2

Configuring Security for SMTP Traffic

Overview of Web Services API

CRM Setup Factory Installer V 3.0 Developers Guide

CHAPTER 10: WEB SERVICES

AWS Directory Service. AD Connector Administration Guide Version 1.0

Mail User Agent Project

JAVAMAIL API - SMTP SERVERS

ScavengerEXA. An open source program To fight spam at the source. Thomas Mangin Exa Networks UKNOF /02/13

WagoLibMail_02.lib. Contents

# Constructors $smtp = Net::SMTP->new('mailhost'); $smtp = Net::SMTP->new('mailhost', Timeout => 60);

Releasing blocked in Data Security

XMailer Reference Guide

SharePoint Reset Password Web Part

Basic Exchange Setup Guide

Cork Institute of Technology Master of Science in Computing in Education National Framework of Qualifications Level 9

AWS Directory Service. Administration Guide Version 1.0

Developing Task Model Applications

Qsync Install Qsync utility Login the NAS The address is :8080 bfsteelinc.info:8080

CORBA Programming with TAOX11. The C++11 CORBA Implementation

# Constructors $smtp = Net::SMTP->new('mailhost'); $smtp = Net::SMTP->new('mailhost', Timeout => 60);

SendMIME Pro Installation & Users Guide

Basic Exchange Setup Guide

Microsoft Virtual Labs. Building Windows Presentation Foundation Applications - C# - Part 1

See the Developer s Getting Started Guide for an introduction to My Docs Online Secure File Delivery and how to use it programmatically.

Mail Avenger. David Mazières New York University

Software Engineering 1 EEL5881 Spring Homework - 2

Numerical Algorithms Group

2009 Tutorial (DB4O and Visual Studio 2008 Express)

bbc Developing Service Providers Adobe Flash Media Rights Management Server November 2008 Version 1.5

POP3 Connector for Exchange - Configuration

Novell Identity Manager

LabVIEW Internet Toolkit User Guide

Owner of the content within this article is Written by Marc Grote

T-CONNECT EDI VIEWER. Installation and User Guide 12/16/2014 WE BUILD SOFTWARE THAT HELPS OUR CLIENTS GROW DOCUMENT CREATED BY:

From SPAMfighter SMTP Anti Spam Server to SPAMfighter Mail Gateway

: provid.ir

MS Enterprise Library 5.0 (Logging Application Block)

Hands-On Lab. Client Workflow. Lab version: Last updated: 2/23/2011

ResPAK Internet Module

OR Filter 3.2 Manual. Draft. Copyright 2003, Martijn Jongen. All Rights Reserved Version : Ref. nr. : MhJ/ By : M.

Implementing a WCF Service in the Real World

Introduction Configuration & Spam Detection WinWare Webmail Accounts Account Notes Definitions...


Title Release Notes PC SDK Date Dealt with by, telephone. Table of Content GENERAL Corrected Issues PDD...

CS43: Computer Networks . Kevin Webb Swarthmore College September 24, 2015

s sent to the FaxFinder fax server must meet the following criteria to be processed for sending as a fax:

Content Filtering With MDaemon 6.0

JAVA Program For Processing SMS Messages

smtplib SMTP protocol client

webcrm API Getting Started

Brekeke PBX Web Service

The full setup includes the server itself, the server control panel, Firebird Database Server, and three sample applications with source code.

IBM Tivoli Workload Scheduler Integration Workbench V8.6.: How to customize your automation environment by creating a custom Job Type plug-in

**Web mail users: Web mail provides you with the ability to access your via a browser using a "Hotmail-like" or "Outlook 2003 like" interface.

Tutorial: Windows Mobile Application Development. Sybase Unwired Platform 2.1 ESD #2

Synchronizing databases

one million mails a day: open source software to deal with it Charly Kühnast Municipal Datacenter for the Lower Rhine Area Moers, Germany

ECE Mail System Overview. Pablo J. Rebollo ECE Network Operations Center

Title Release Notes PC SDK Date Dealt with by, telephone. Table of Content GENERAL... 2

Lab 8: ASP.NET 2.0 Configuration API and Health Monitoring

Implementing multi-user multi-touch scenarios using WPF in Windows* 8 Desktop Apps

WebSpy Vantage Ultimate 2.2 Web Module Administrators Guide

Emacs SMTP Library. An Emacs package for sending mail via SMTP. Simon Josefsson, Alex Schroeder

WaveWare Technologies, Inc. We Deliver Information at the Speed of Light

Troubleshoot ViewMail for Outlook Issues

Election 2012: Real- Time Monitoring of Election Results

Network Services. SMTP, Internet Message Format. Johann Oberleitner SS 2006

Using scanners with Axapta Document Management

TNote125 Student Locator Framework Notification Diagnostics

Chapter 2 Application Layer. Lecture 5 FTP, Mail. Computer Networking: A Top Down Approach

Authoring for System Center 2012 Operations Manager

ESET Mail Security 4. User Guide. for Microsoft Exchange Server. Microsoft Windows 2000 / 2003 / 2008

Status of Registration Requests

LISTSERV LDAP Documentation

The guide about TCP/IP connections between PC s and PLC s

Installing Microsoft Exchange Integration for LifeSize Control

Use Domain Name System and IP Version 6

NatNet API. User s Guide. Version April Technical support help.naturalpoint.com

. Daniel Zappala. CS 460 Computer Networking Brigham Young University

Chapter 9 Delegates and Events

VoIP Probe 3.4. Functions, Parameters & Metrics for integration with HP Business Availability Center via HP Business Process Monitor

CipherMail Gateway Quick Setup Guide

USHA. Notification Setting. User Manual

Web Server Manual. Mike Burns Greg Pettyjohn Jay McCarthy November 20, 2006

BACKING UP A DATABASE

Computer Networking. First, you will use the ifconfig command to retrieve the IP address of the computer you are using:

Web Services API Developer Guide

LAB 6: Code Generation with Visual Paradigm for UML and JDBC Integration

Filtered Views for Microsoft Dynamics CRM

Demo: Controlling.NET Windows Forms from a Java Application. Version 7.3

This section provides a 'Quickstart' guide to using TestDriven.NET any version of Microsoft Visual Studio.NET

Transcription:

How to create a SMTP plugin for ArGoSoft Mail Server,.NET edition (AMS.NET edition) using Visual Studio 2005 About SMTP plugins for AMS.NET edition Plugins should be placed in.net assemblies. One assembly may contain multiple plugins. Each plugin is a class, which implements ISmtpPlugin interface, declared in the Argosoft.Plugins assembly, shipped with mail server. Plugins are loaded using reflection at runtime, during each SMTP connection. Argosoft.Plugins assembly declares an enumeration PostProcessResult: public enum PostProcessResult Accept, Reject, Ignore Also, four delegates: public delegate void AfterConnectDelegate(object sender, string ipaddress, ref bool reject, ref string reply); public delegate void AfterMailFromDelegate(object sender, string ipaddress, string mailfrom, ref bool reject, ref string reply); public delegate void AfterRcptToDelegate(object sender, string ipaddress, string rcptto, bool islocal, ref bool reject, ref string reply); public delegate void PostProcessDelegate(object sender, string ipaddress, ref string mailfrom, ref List<string> rcptto, ref StringBuilder msgdata, ref PostProcessResult postprocessresult, ref string reply); They correspond to four different phases of SMTP connection, and are types of four event handlers, exposed by ISmtpPlugin interface. public interface ISmtpPlugin AfterConnectDelegate AfterConnect get; set; AfterMailFromDelegate AfterMailFrom get; set; AfterRcptToDelegate AfterRcptTo get; set; PostProcessDelegate PostProcess get; set; string Description get;

If any of above event handlers is not used, an implementation must return NULL. If server has multiple plugins, events are called in order listed in the plugins.xml file (see below). If at least one handler rejects connection, further plugins are not called. AfterConnect event handler As soon as connection is established, server calls AfterConnect event handlers, before sending a greeting, but after checking an IP address with Auto Lockout (see Security Auto Lockout in the mail server). Parameters for AfterConnect event handler are as follows: bool reject a result, returned by plugin. If true, the server will send back a reply, specified in a reply parameter (see below); SMTP error code, and contain an explanation, for example: 501 Your IP Address has been rejected (without double quotes). If reject parameter is false, then reply parameter is ignored. AfterMailFrom event handler Is called after MAIL FROM SMTP command is transmitted, but before the server specifies sender domain name (if enabled). Parameters for AfterMailFrom event handler are as follows: string mailfrom an email address, transmitted with MAIL FROM command; bool reject a result, returned by plugin. If true, the server will send back a reply, specified in a reply parameter (see below); SMTP error code, and contain an explanation, for example: 501 Your Address has been rejected (without double quotes). If reject parameter is false, then reply parameter is ignored.

AfterRcptTo event handler Is called after each RCPT TO SMTP command. Parameters for AfterRcptTo event handler are as follows: string rcptto an email address, transmitted with RCPT TO command; bool local true if recipient is local; bool reject a result, returned by plugin. If true, the server will send back a reply, specified in a reply parameter (see below); SMTP error code, and contain an explanation, for example: 501 Recipient has been rejected (without double quotes). If reject parameter is false, then reply parameter is ignored. PostProcess event handler This event handler is, perhaps, the most complex among others. It is called after a content of email is transmitted to the server, and delivering MTA expects a confirmation reply from server. Parameters for PostProcess event handler are as follows: string mailfrom an email address, transmitted with MAIL FROM command; List<string> rcptto an entire list of addresses, transmitted by MTA, and not rejected by mail server (or plugins). This list can be altered by PostProcess event handler, server will accept the changes, and deliver mail accordingly (of course, depending on the value of postprocessresult parameter, see below); StringBuilder msgdata it is a rfc822 message, exactly as it was accepted by server. The content of this information also can be altered by the event handler; PostProcessResult postprocessresult it is the out parameter. If it s value is PostProcessResult.Accept, then message will be accepted, and control will be passed to the server, if it is PostProcessResult.Ignore, then server will assume, that processing for the message has been completely done by the server. It will notify the delivering MTA, that email has been accepted, but will not do any further work for delivering mail to recipients. If the value of reply is

PostProcessResult.Reject, then server will send back an error message, contained in the reply parameter (see below); SMTP error code, and contain an explanation, for example: 501 Your message has been rejected (without double quotes). This parameter will be used only when postprocessresult (see above) is PostProcessResult.Reject; Sample SMTP Plugin To begin with, let s create a skeleton of our future SMTP plugin. Launch Visual Studio 2005, create a class library, name it TestPlugin, add a reference to Argosoft.Plugins.dll assembly (it is located in the root directory of mail server installation), and add a class SenderDomainChecker, add a reference to Argosoft.Plugins assembly (it is located Content of a SMTP plugin, which does nothing, is below: using System; using System.Collections.Generic; using System.Text; using Argosoft.Plugins; namespace TestPlugin public class SenderDomainChecker : ISmtpPlugin public AfterConnectDelegate AfterConnect get return null; set public AfterMailFromDelegate AfterMailFrom get return null; set public AfterRcptToDelegate AfterRcptTo get return null; set public PostProcessDelegate PostProcess get return null; set public string Description get return "Test Description";

Now, let s create a plugin, which checks whether the domain name of sender exists. To do it, add to the above class an event handler for AfterMailFrom delegate, and initialize the handler. Also, we will have to add System.Net and System.Net.Sockets to the using section. Final code would look like this: using System; using System.Collections.Generic; using System.Text; using System.Net; using System.Net.Sockets; using Argosoft.Plugins; namespace TestPlugin public class SenderDomainChecker : ISmtpPlugin public AfterConnectDelegate AfterConnect get return null; set private AfterMailFromDelegate aftermailfrom = new AfterMailFromDelegate(CheckDomain); public AfterMailFromDelegate AfterMailFrom get return aftermailfrom; set public AfterRcptToDelegate AfterRcptTo get return null; set public PostProcessDelegate PostProcess get return null; set public string Description get return "Checks if domain name of sender is valid"; private static string PickDomain(string address) int i = address.indexof('@'); if (i > -1) return address.substring(i + 1); else return ""; public static void CheckDomain(object sender, string ipaddress, string mailfrom, ref bool reject, ref string reply) reject = false; reply = "";

string domain = PickDomain(mailFrom); if (domain!= "") try IPAddress[] ipaddresses = Dns.GetHostAddresses(domain); return; catch (SocketException) reject = true; reply = String.Format("501 Sender domain 0 appears to be invalid", domain); catch Now, we can build our assembly, move resulting DLL file into the mail server root directory, and add it to the list of plugins Security SMTP Plugins and use it. To add it to the list of plugins, run the mail server UI, go to Security SMTP Plugins, and add assembly name and class name: