Sunday 23 December 2018

Automatically send multiple emails from Outlook at specific times


I have a need to send an email every 10 seconds for about 2 minutes, but I'd like to schedule this to occur starting at a specific time (8:59) and ending near a specific time (9:01).


I need to ensure that an email is sent starting at 8:59 for the first one and send the same email again every 10 seconds (interval-wise) but I need it to end at 9:01 or so.


I use Outlook for my email client software and I'm a local administrator on my PC—I am not the network administrator if that makes any difference to anyone.


Does anyone know of a program or method of accomplishing this task? I'm fine with using an application that can do this or that can change the time-stamp perhaps as well.



Answer




Automatically send multiple emails from Outlook at specific times


I have a need to send an email every 10 seconds for about 2 minutes, but I'd like to schedule this to occur starting at a specific time (8:59) and ending near a specific time (9:01).


I need to ensure that an email is sent starting at 8:59 for the first one and send the same email again every 10 seconds (interval-wise) but I need it to end at 9:01 or so.



Below I have listed TWO options for automatically sending emails at specific times


Use sendEmail, Batch Script, and Windows Task Scheduler


One way (at the bottom of my answer) is with scheduling a batch script to send on a custom schedule with Windows Task Scheduler with the sendEmail application.


I setup the batch script logic below for the sendEmail script to have a counter in it that starts at 0 and ends at 12 with about 10 seconds between each next higher digit counting up by 1.


(This means you will want to start this script at the exact time and second you want it to start and it'll send every 10 seconds up until 2 minutes (e.g. 8:59:00 AM) after that point.)


enter image description here


It appears Windows Task Scheduler doesn't get as granular with scheduling or triggering a task to the second (one minute interval seems to be it's limit). I put a 120 second timer in the batch script logic below, and it'll send an email every 10 seconds until it counts to 120 seconds (or two minutes) and then end.


Getting sendEmail Ready and Scheduled with Batch Script




Scheduled Batch Script with sendEmail


(You should be able to get away with the above "No TLS" download and exe for the sendEmail application that you'll schedule for sending emails with a batch script, calling it via command line, and scheduling it with Windows Task Scheduler—If you have trouble or need to authenticate with TLS, I'll add an example script how to do it that way as well if needed.)


(When you download the Zip file from the links provided, just put the exe in a Windows directory in your PATH environmenal variable (i.e. %SYSTEMROOT%\System32) or call it full path explictly (e.g. "C:\SendEmail\sendEmail.exe"). The example batch script logic expects it in a PATH environmental variable location. If you need logic to point to it explicitly, tell me the full path where you need to reference the exe and I'll add an example that way too.)


@ECHO OFF
::: --// Set the counter variable to zero when script begins
SET Counter=0
GOTO :okNowReallySendEmail

:SendEmail
::: --// Add 1 to counter variable to know when it gets to 12 for every 10 seconds is two minutes 8:59 - 9:01
SET /A Counter=%Counter%+1

::: --// Ping delay to loopback roughly 10 second count
PING -n 10 127.0.0.1 > NUL

::: --// End if counter is 12 as that's 12 times 10 which equals 120 seconds roughly
IF %Counter%==12 GOTO EOF

:okNowReallySendEmail
SET EMAILSERVER=emailserver.domain.com
SET subject=This is my subject
SET FromAddress=YourEmailAddress@Domain.com
SET ReplyAddress=YourEmailAddress@Domain.com
SET ToAddress=ToEmailAddress@Domain.com
SET EMAILBODY1=This is my email body paragraph1
SET EMAILBODY2=This is my email body paragraph2
SET Signature=My Name
SENDEMAIL -f %FromAddress% -t %ToAddress% -u %subject% -m "%EMAILBODY1%

%EMAILBODY2%

%Signature%" -s %EMAILSERVER%:25 -o message-content-type=html reply-to=%ReplyAddress%
GOTO :SendEmail

Task Scheduler


See this answer here for full details of what options you should pick when scheduling this job with Windows Task SchedulerOptions to Select with Task Scheduler Job Setup


(Don't forget to upvote this answer if helpful as well)




Use Outlook Delay or Schedule Sending Messages


The second way is with Outlook (2010 and 2013) using the Delay or schedule sending messages feature that is a little less specific on the time scheduling part (not by the second either).


When you tell Outlook not send before a certain time on a certain date, it'll send as soon as Outlook's outbox emails try to send queue items out when it's that time or later when it's triggered.


I have seen email sent via this method keep the date and time stamp of the actually time you sent these options and press Send rather than the time you told it to not run before. When you press Send to send it out, it just sits in an Outlook outbox queue until that time but not before.


enter image description here



Outlook 2013



Outlook 2010


No comments:

Post a Comment

Where does Skype save my contact's avatars in Linux?

I'm using Skype on Linux. Where can I find images cached by skype of my contact's avatars? Answer I wanted to get those Skype avat...