Automated Daily Email in Microsoft Outlook
Hi, let me first introduce myself as a new member and a complete VBA noob. I found the site looking for a way to write a macro in Microsoft Outlook. I have used macros in Excel but I barely write the code, I cheat and use the "record" button.
What I need to do is this:
I need a way that I can have outlook send an email with a short bit of text every day. It will be the same text (just 3 words really). It will be sent to the same person every day. It would be really great if I could make it randomly send the email between 6am and 7am. If this is too much work then one standard time would be fine, or it could be when I start outlook each morning. If anyone can help I'd really appreciate it.
Re: Automated Daily Email in Microsoft Outlook
hi,
Sending mail via Outlook (Not Outlook Express) requires autorisation from the user. there is a security feature that prevents "mail Boming" using MS outlook.
there is a way to send the mail but it will require some imput from a user when the mail is to be sent.
if you want to send the mail by cliking the button then let me know and i will get some code up for you.
also please confirm it is outlook and the Version?
thanks
David
Re: Automated Daily Email in Microsoft Outlook
Quote:
Originally Posted by Davadvice
hi,
Sending mail via Outlook (Not Outlook Express) requires autorisation from the user. there is a security feature that prevents "mail Boming" using MS outlook.
there is a way to send the mail but it will require some imput from a user when the mail is to be sent.
if you want to send the mail by cliking the button then let me know and i will get some code up for you.
also please confirm it is outlook and the Version?
thanks
David
Yes sir, outlook 2003 it is.:thumb:
Re: Automated Daily Email in Microsoft Outlook
Hi,
here is the code you will need to send the mail.
i'm not too sure about using a timer with outlook to send at a specific time. I will look into it later and get back.
If you go to tools>Macro and click on Vb Editor
on the left expand the tree and select this outlook session.
paste the below code and add an e-mail address (your own should be used to test) to this line in the code. omsg.Recipients.Add "enterEmailAddressHERE"
vb Code:
Public Sub SndFirstMail()
Dim strmsg As String
Dim oApp As New Outlook.Application
Dim omsg As Outlook.MailItem
strmsg = "Test" & vbCrLf & " I am testing this message"
Set omsg = oApp.CreateItem(olMailItem)
omsg.Recipients.Add "enterEmailAddressHERE"
omsg.Body = strmsg
omsg.Send
End Sub
if you press F8 it will allow you to step through the code.
good luck
David
Re: Automated Daily Email in Microsoft Outlook
How will it know to send this once per day?
Re: Automated Daily Email in Microsoft Outlook
Hi
you will have to add a sub and set up a timer when the timer reaches a Value you can check the system time then if the time is within the range you require you send the mail.
If outlook is open all the time(24/7) then you should set a boolean Value to mark that you have sent the mail for that date.
I would assume there may be an onload type function when you open outlook that may also be able to call the SndFirstMail procedure.
I am no expert in coding outlook so i am unsure of how to do this.
I would advise that you should set up a small exeutable (if available) that could perform this task. if you don't have this available you could use access, or Excell and leave these open so it can send the mail.
thanks
David
Re: Automated Daily Email in Microsoft Outlook
If you write code in the VBA editor then it will be easier to automate. If you need this to be distributed to other users then perhaps its best to write a ful AddIn for it.
You may want to check out my Office FAQ (link in signature) for more information.