Friday, April 11, 2008

Sending Email without a Client

Sending Email without a Client

Sending e-mail is typically done from an e-mail client such as Microsoft Outlook. There may be times when you wish you could send an e-mail message without needing a client application.

Thankfully there are a number of ways to accomplish this task.


1) Troubleshooting SMTP can be done via telnet,

2) you can send e-mail from a VBS script or using ASP code,

3) There are tools like MAPISend and Blat that allow you to send email from the command line or a batch file
MAPISend.exe is a command line tool that is available from the Exchange Server 2000 Resource Kit.
You can use MAPISend to connect to a mailbox on your Exchange server and send an email message.
There are a few basic switches you need to know in order to make it work.


* -u is used to specify the profile

* -r specifies the recipients e-mail address

* -s specifies the subject of the e-mail message

* -m specifies the body of the e-mail message



In order for MAPISend to work, a MAPI profile must exist on the computer that the e-mail message is being sent from.

Let’s look at an example of the MAPISend command.



C:\> MAPISend –u “Exchange Profile” –r FFlintstone@thelazyadmin.lab –s “Interested in Bowling Tonight?” –m “Hi Fred Are you interested in bowling tonight? Barney”

Pretty simple isn’t it?


This command can be very useful if you wish to send a message once a batch job has completed running. The message can be sent anywhere. I use this command to send me an e-mail to the SMS address of my Smartphone when certain automated tasks are complete.



If you do not have a copy of the Exchange Server 2000 Resource Kit there is another option called Blat.
Blat is a free, command line, SMTP mailer application. It is very similar to MAPISend; however it does not require a mail profile to be present on the sending computer.

The important command line switches you need to know are:


* -t specifies the sender’s e-mail address

* -r specifies the recipient’s e-mail address

* -subject specifies the subject



The only big difference between MAPISend and Blat is the body of a message sent with Blat is pulled from a TXT file.



C:\> Blat.exe body.txt –t fflintstone@thelazyadmin.lab –f brubble@thelazyadmin.lab –subject “Interested in Bowling Tonight?”



Blat is also very useful for sending messages from batch files to SMS addresses or just regular e-mail addresses.

No comments: