batch file - sending mail using email address list file

  • Q: How can I send an email to multiple recipients?
  • A: To send an email to multiple recipients, just enter their email addresses after -TO command separated by comma.

Since febooti Command line email version 3.0 it is possible to use -TOEACH (or -SPLIT) parameter to separate / split recipients.

Recipients separated by comma:

C:\>febootimail -TO rec1@mail.com, rec2@mail.com, rec99@mail.com, etc@mail.com -FROM john@sender.com -TEXT send multiple recipients email separated by comma 

Given that there is a constant list of persons to which email is sent automatically or on regular basis, it is more convenient to enter email list in text file. Then instead of typing all addresses in command line, -USEFILE parameter after -TO parameter will effect in the same result.

adr1@recipient.com
adr2@recipient.com
adr3@recipient.com 
febootimail -TO -USEFILE emails.txt -FROM john@e-sender.com -TEXT send multiple recipients email using usefile parameter 

If for some reason you do not want to make recipient addresses visible to each other or if recipient list is big enough to exceed email header size limitations of some servers, it is a good idea to send these emails out individually to each recipient. Command line for this task should look like in this example:

C:\>FOR /F %u IN (emails.txt) DO febootimail -FROM joe@server.com -TO %u -MSG "sending command line mails individually" 

In this case emails.txt file is parsed line by line and mail is sent out step by step. If some line of email.txt file contains more than one recipient, a common mail will be sent to recipients contained within this particular line (they all will appear in TO field of email header).

If each emails.txt line has virtually separated entities, namely, number of line, email address, name, surname. Entity containing email address is the second one in this particular case. To send emails using such email list file, batch file should look like below.

1. john@recipient.edu John Korzow
2. josh@server.biz Josh Trianova
3. jack@email.com Jack Treznock 
C:\>FOR /F "tokens=2" %u IN (recipients.txt) DO febootimail -FROM e-mail@sender.com -TO %u -TEXT "sending individual messages using advanced recipient list file" 

tokens=2 in this batch file specifies that second logical entity from each line will be taken and used as email value. Note that by default only spaces and tabs are processed as logical separators. In case logical entities are separated with comma or other symbol, delims= parameter can be used with specifying delimiter symbol.

1.,john@recipient.edu,John Korzow
2.,josh@server.biz,Josh Trianova
3.,jack@email.com,Jack Treznock 
C:\>FOR /F "tokens=2 delims=," %u IN (e-mails.txt) DO febootimail -FROM e-mail@sender.com -TO %u -TEXT "sending individual messages using delims and comma separated recipient list file" 

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.