Many users hope that Outlook can auto use different email accounts to send emails on basis of the working hours, like using one during working hours and the other one outside working hours. This article will show how to realize this.
Perhaps you are accustomed to sending email via your working email account in the working hours and sending via the private email account outside the working hours. In this situation, why don’t you make Outlook to auto switch between the two different accounts on basis of the working hours? Thereinafter, we will teach you how to achieve it.
Auto Use Different Accounts to Send Emails Based on Working Hours
- In the first place, launch your Outlook application.
- After getting into the main Outlook window, press “Alt + F11” key buttons.
- Then, a window called “Microsoft Visual Basic for Applications” will display, in which you need to open a module that is not in use.
- Next, copy and paste the following VBA code into this module.
Sub SendEmail() Dim objMail As Outlook.MailItem Dim dCurrentTime As Date Dim objMailAccounts As Outlook.Accounts Dim objMailAccount As Outlook.Account If TypeOf Outlook.ActiveInspector.currentItem Is MailItem Then Set objMail = Outlook.ActiveInspector.currentItem Set objMailAccounts = Outlook.Application.Session.Accounts dCurrentTime = Format(Now, "hh:mm:ss AM/PM") 'Use different accounts based on working hours If dCurrentTime >= #9:00:00 AM# And dCurrentTime <= #6:00:00 PM# Then For Each objMailAccount In objMailAccounts If objMailAccount.DisplayName = "email@example.com" Then objMail.SendUsingAccount = objMailAccount objMail.Send End If Next Else For Each objMailAccount In objMailAccounts If objMailAccount.DisplayName = "firstname.lastname@example.org" Then objMail.SendUsingAccount = objMailAccount objMail.Send End If Next End If End If End Sub
- After that, you can exit the current window.
- Subsequently, add this new macro to the Quick Access Toolbar or ribbon of Message window.
- First off, create a new email.
- Then, hit the down arrow in Quick Access Toolbar.
- Next, from the drop down list, choose “More Commands”.
- In the popup “Outlook Options” window, you can take the steps shown in the screenshot below to achieve it.
- Eventually, you can take a shot. Create and compose an email. Then click the macro button in Quick Access Toolbar. The email will be sent out by specific email account based on whether the current time is in working hours or not.
- From now on, to send email, instead of the standard “Send” button, you can use this new “Send” macro button in Quick Access Toolbar.
What Can Result in Outlook Damage
Although Outlook is a near perfect email client with various features, it still can’t get rid of errors and damage due to too many risks around it. For instance, in the current era, viruses are all around, such as email borne viruses, which are usually disguised as innocuous objects in an email. They can ruin your Outlook data in a moment. Besides, incorrect operations, hardware issues and others can result in Outlook damage in a jiffy. Thus, you had better keep a mighty PST repair tool, like DataNumen Outlook Repair, in vicinity, so that you can rescue your data as soon as possible.
Shirley Zhang is a data recovery expert in DataNumen, Inc., which is the world leader in data recovery technologies, including corrupted sql and outlook repair software products. For more information visit www.datanumen.com