CmdMail: Command line email utility
Category:
C#, VB.NET, ASP.NETType:
ApplicationsDifficulty:
IntermediateAuthor: Anonymous
Version Compatibility: Visual Basic.NET
More information:
Application to send email messages from the command line which is handy for network alerts and the like. Copy and paste into a VB.Net console application.
Command line arguments are fairly straight forward (run /? to see basics or just look at the code below!). As an example:
cmdmail.exe
/s "mail.server.com.au"
/u "Test Subject"
/f "from@somewhere.com.au"
/t "to@somewhere.com.au"
/y "c:\test\MyHTMLBody.htm"
/o 1
/a "c:\test\_TestFile.txt;c:\test2\_TestFile2.txt"
The body of the message can be specified in one of two ways - using /d parameter where you write the body as part of the command line or /y where you specify a file to load the body from. This is helpful when sending HTML messages (format /o 1) where the command line can get a bit unwieldy.
.Net Technologies used:
WebMail (email)
File I/O
Reflection
Instructions: Copy the declarations and code below and paste directly into your VB project.
Declarations: