Command line e-mail - define parameters in batch files

  • Q: Can I use an .ini file to store most common parameters like -SMTP, -PORT, -FROM etc. in order not to type it in command line each time I want to send a mail?
  • A: Instead of typing all the parameters into command line, it is possible to create a batch file for this purpose.

Since Febooti Command line email version 3.0 it is possible to use -CONFIG (or -CFG) parameter to replace part of the command line with contents of configuration file.

Constant parameters that do not change from time to time should be specified in the same way as they are normally entered into command line. Instead of variable parameters use %1 %2 … %9.

@Echo off
rem Define batch file parametters

febootimail -SMTP smtp.server.com -FROM john@sender.com -FROMNAME John Doe -TO -USEFILE %1 -TEXT -USEFILE %2 %3 %4 %5 %6 %7 %8 %9

rem NOTE...
rem This batch file accepts 9 parametters

When executing this batch file additional parameters should be specified in command line. In this case you should specify file that contains recipient addresses as the first variable and file that contains message text as the second one.

C:\>mail.bat recipients.txt message.txt

Also, any other command line email parameter can be used as third, forth etc. batch parameter.

C:\>mail.bat recipients.txt message.txt -FILE date.jpg -CONFIRM

In this case recipients.txt will be passed to batch file as %1, message.txt as %2, -FILE as %3 and date.jpg as %4, -CONFIRM command as %5. Altogether it will effect in executing the following full sequence:

  • febootimail -SMTP smtp.server.com -FROM john@sender.com -FROMNAME John Doe -TO -USEFILE
    recipients.txt -TEXT -USEFILE message.txt -FILE date.jpg -CONFIRM %6 %7 %8 %9

There is no need to worry about unused variables since command line email ignores them. On the other hand these variables can be used anytime when there is a need to pass additional non-common email parameters to command line email utility.

Please do not hesitate to contact our support department with any possible further questions or to solve practical issues connected with Command line email. The solution will be provided shortly by e-mail and eventually added to FAQ.

Copyright © 2001-2013 Febooti Software. All rights reserved. Last updated: March 15, 2012