How to send mail from command line in Windows

Below is a step-by-step process of how to send mail from a command line for FREE using any version of Windows.

  1. Please show your interest for “Send Mail From Command Line” utility by sending an email to info@infinetpoint.co.uk, or
  2. Register your interest in this utility by visiting the Contact Us page.  We will get back to you with instructions to purchase.  You will then be able to download the utility and use as outlined below.
  3. Create a folder called C:\SMFCL and unzip the downloaded files to this folder
  4. You will see a file called smfcl.exe.  This is all you need to send mail from command line
  5. Open a DOS command window and locate C:\SMFCL folder:
  6. Type configuration settings for your SMTP server which will be saved into an INI file as a ONE-OFF and your password encrypted from prying eyes. See below syntax
  7. C:\SMFCL>smfcl /w “|<Server address>|<User name>|<Password>|<Port>|<SSL either False or True>|<SPA either False or True>|<Sender email address>|”
  8. As an example: C:\SMFCL>smfcl /w “|127.0.0.1|jbloggs|pa55w0rd|25|False|False|jbloggs@domain.com|”
  9. Now send any mail from command line by typing the following:
  10. C:\SMFCL>smfcl /s “|<Recipient email address>|<Subject>|<Email body>|”
  11. As an example: C:\SMFCL>smfcl /s “|admin@companyxyz.com|ADMIN ALERT-HARD DISK LOW!|The hard disk capacity has reached critical level.  Please attend immediately!|”
  12. The specified email be sent as defined and an entry written to a log file which will be created automatically under C:\SMFCL\Logs
  13. If any problem is encountered this too is written to the log file for trouble-shooting

If you wanted to send an attachment with your email, this too is possible with Send Mail From Command Line utility.  Below is the syntax for sending attachments:

When using the send switch “/s” add an extra element for the attachment path as follows:

C:\SMFCL>smfcl /s “|<Recipient email address>|<Email Subject>|<Email body>|Full attachment path”

As an example: C:\SMFCL>smfcl /s “|admin@companyxyz.com|Admin Alert – hard disk full!|The hard disk capacity has reached critical level.  Please attend immediately!|D:\Logs\mylog.txt”

Trouble-shooting tips

  • Make sure your SMTP port 25 is allowed through firewalls and your ISP is not blocking it
  • Make sure you type the configuration details accurately and the syntax is correctly followed
  • Check the Logs folder for the log created for that day as SMFCL creates a new log file for each day it is used.  Rectify any errors shown therein