MiniM. Saving time.

| About | Download | Tools | Knowledge Base | How to Buy |

MiniM Overview

Getting Started




Cache Tools

GT.M Tools

Knowledge Base




MiniM Knowledge Base | Nov 8, 2010

How to send SMTP mail with attachment

In many cases application servers use a mail messages through SMTP protocol and this article describes one of possible case to create and send SMTP mail message and message with an attachment.

Sample how to use SMTP mail contains three routines:

  • SMTPSEND - utility to create and send message
  • SMTPEXAM1 - routine to create text message
  • SMTPEXAM2 - routine to create text message with file attachment

The SMTPSEND routine contains subroutines to create mail message parts

  • message delimiter
  • create and encode message body
  • create and encode attachment
and also implements SMTP send protocol to interact with SMTP server.

The basis of SMTP protocol is interaction with SMTP server over TCP/IP protocol in text mode and send message as special message headers, message body and attachments with special encoding.

Examples and utility contains embedded into code constant strings with email, SMTP TCP port number by default and SMTP server by default. To use this routines in your application, of course, you must change or rewrite routines for you server settings and your email address.

First example SMTPEXAM1 sends simple text message with simple encoding.

Second example SMTPEXAM2 sends simple text message with BASE64 encoding and with file attachment and BASE64 encoding too.

Links with SMTP mail protocol: (ENG) (RUS)

this pages contain links to RFC documents with detailed description of recommended encoding and protocol implementations.

Download (zip, 2.5Kb)

Eugene Karataev

Copyright (C) Eugene Karataev
Info Support