Use windows batch processing to implement Simple Mail group Function
The company's business assistant is a cute sister paper, it is the kind of background that www.2cto.com will be very eye-catching and eye-catching for dozens of seconds when I see that I want to send various business emails to many customers. ------------------- Cut --------------- many times, due to business dealings, we will send customers emails with the same content (non-communication group customers), the most common such as holiday cards, greetings. In fact, the combination of word + excel + outlook is enough to meet these needs, but for many cute non-IT people, they may not have the patience to do the tedious steps. Today, www.2cto.com, with a small tool, we can add some simple windows batch processing commands to see how to implement and batch send simple emails. Official gadgets: http://www.blat.net You can search for the "blat email tool" on many download websites in China. It is currently version 2.5. This is a simple tool for sending emails in command line mode, I will not describe how to use the tool here. There are many great strategies on the Internet than I have said. This tool implements single sending, And we can add something to implement group mail, previously, we performed an AD migration project for an enterprise. This was the only option for over 4000 emails containing new passwords. 1. after the tool is downloaded, it contains the following three files: blat.dllw.blat.exe and blat. lib 2. we have created three txt files under the same directory of these three files. To make it easy to identify, I have created three file names 3.we have written to the recipient list in terminal 01.recipient address .txt and saved them, each recipient is a single line 4.We will write the mail content in container 02.mail content .txt, save 5. double-click "03. mass mailing. bat "to start the sender-related information configuration, enter your SMTP server address, email login name, login password, email subject, whether to add attachments, and press enter to confirm 6. note that if you add an attachment, you need to enter the absolute path of the attachment. In bytes, each row of the attachment is the correct recipient of www.2cto.com, 8. the recipient's prompt after receiving the email 9. let's open the email to see if it is the same as the content we have edited? 10. There is a picture of the truth, and the mail content and attachments are all designated for sending. 11. after the process is displayed, let's take a look at how the batch processing commands are implemented. Because many command lines are repeated, they are not all pasted here, here we only introduce the core part. Note that the red part is the tool command. The original file will be uploaded to BKJIA through attachment. ------------------- Cut ------------------ @ echo offecho. echo Please enter your SMTP server address set/p a = for example, Sina mail is smtp.sina.com: 1 set "t =" // Why is this empty? To clear the configured parameter set/p t = to be added (y/n): // The/P here is the command line switch, enter set/? In CMD /? For details, see if % t % = y (goto: 4) else (goto: 2) // based on your input, determine which command echo to continue executing. echo.: 2if % t % = n (goto: 3) else (echo input error, only lowercase y or n can be identified) // If the attachment is incorrect, the system will prompt an error and jump to start pinging 127.0.0.1> nulgoto: 1: 3 echo is registering the service for you. Please wait .... @ echo offblat-install % a % B % 25 // based on your previous input, register the server address for/f % I in (01.recipient address .txt) do (// for/f % I is the loop to read the recipient address blat 02.mail content .txt-to % I-s "% d %"-u % B %-pw % c %-charset Gb2312 // based on your previous input, start to send the email if % ERRORLEVEL % = 0 echo % I sent successfully // for emails that have been sent successfully, the "sent successfully" prompt echo is displayed .) pauseexit