Labels

Wednesday, December 28, 2011

send mail with command (free)


If you want to send a single e-mail message or hundreds of them and do it all from a single batch file or command you should use the MAILSEND program written by Muhammad A Muquit.

This is extremely useful in E2K. Whenever you create new mailbox-enabled users you need to send them an e-mail message before you can begin to manipulate mailbox permissions etc. I use MAILSEND to automate this task.

MAILSEND is a simple program to send mail via SMTP for MS Windows NT/2000/XP. To use it, you must know the address or IP address of the SMTP server you wish to use.

MAILSEND is a console application, you can run it from command shell or by clicking on the app from file explorer. You can use it in many ways. I'm using 192.168.0.200 as the IP address of the SMTP server as an
example, change this to your valid one. Some example are shown below:

Interactive usage

MAILSEND
SMTP server address/IP: 192.168.0.200
Domain: mydomain.com
From: me@mydomain.com
To: you@yourdomain,otherperson@otherdomain.com
Carbon copy: him@example.com
Blind Carbon copy:
Subject: This is a test
================================================
Type . in a new line and press Enter to end the message, CTRL+C to abort
================================================
this is a test
this is a test
.

Non-interactive usage

Everything the program needs can be fed from stdin or from a file.
Examples:
MAILSEND -d mydomain.com -smtp 192.168.0.200 -t me@mydomain.com -f you@yourdomain.com -sub "test" -m msg.txt

message can be passed from stdin as well:
MAILSEND -d mydomain.com -smtp 192.168.0.200 -t me@mydomain.com -f you@yourdomain.com -sub "test" < msg.txt

If no message file is specified, it will ask to type the message:
MAILSEND -d mydomain.com -smtp 192.168.0.200 -t me@mydomain.com -f you@yourdomain.com -sub "test"
================================================
Type . in a new line and press Enter to end the message, CTRL+C to abort
================================================
test. test.
.
Also a file can be created with SMTP server, from, to, cc, bcc, subject and mail body which can be used as a single input to the program. For example, if you create a file like below:
192.168.0.200
mydomain.com
me@mydomain.com
you@yourdomain.com
Mail body starts here.
This file can be used to feed to the MAILSEND program.
  • The first line is the SMTP server address or IP address.
  • The second line is the domain used in SMTP HELO.
  • The third line is the From address.
  • The fourth line the To address/es. They can be command separated.
  • Right after the To the mail body starts.
Now this file can be fed as follows:
MAILSEND -v < msg.txt
You can see the mail getting delivered if you specify the -v flag. Note: in non-interactive mode, you can not specify Cc, Bcc or Subject in the file. If you need any of them specify with appropriate flags.
Download MAILSEND
Or from HERE (local download if author's site ever goes dead).

No comments:

Post a Comment