Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to schedule a mail

Status
Not open for further replies.

getndz

IS-IT--Management
Jul 25, 2007
162
CH
Hello,

How could I schedule a mail to be sent each 3 months to a mail group ?

Thanks
getndz
 
So, you want the exact same email sent out every 3 months? I don't think Outlook directly has that functionality built in. That sounds more like something you'd do on an email server, such as a mailing list perhaps. Otherwise, within Outlook, I suppose you could set up some sort of VBA script to trigger on a given date, and have that trigger create and send your email on each occasion.

--

"If to err is human, then I must be some kind of human!" -Me
 

I have a little program written in VB 6, no GUI so no users input needed, that sends an e-mail to some users every 2 weeks (a reminder about the time sheets for payroll) and I schedule it in my Conrol Panel - Scheduled Tasks set to 2 weeks at 6:00 am

You can even have it a very 'low tech' way of having little text file with the people you want to send an e-mail To, another text file with the Subject line, and another one with the Body of the message. This way you may set several messages going to whom ever you want saying whatever you want at any time. Just don't use it to send SPAM, please.

Have fun.

---- Andy
 
Hello Andrzejek,

Is to remember to the outside users they have to modify the login password. Not to send spams.
I'm not a VB guru, could send the source of the script ?
It woul be very usefull...

Thank you
getndz
 

I could send you the code, but do you have a way to compile it into EXE in VB 6?

Have fun.

---- Andy
 
Asked internally, I believe I (we) can
 

In the folder where my exe is, I have a text file (people.txt) with their names, something like:
[tt]
Andy.Janus
Bill.Clinton
Buggs.Bunny[/tt]

which is just the beginning of the e-mail addresses which have the same domain, so the complete e-mails would be
[tt]
Andy.Janus@some.domain.abc
Bill.Clinton@some.domain.abc
Buggs.Bunny@some.domain.abc[/tt]

So it is easy for me to add/delete people without touching my code (I am very lazy person...) You may have the whole e-mail addresses if you want to, just skip the [tt]strDomain[/tt] parts in the code.

In my VB Project, I added one Reference to:
Microsoft CDO for Windows 2000 Library

and I just have one standard Module (no forms)
Code:
Option Explicit
Dim objMessage As CDO.Message

Sub Main()
Dim ff As Integer
Dim strTextLine As String
Dim strDomain As String
Dim strSendTo As String

ff = FreeFile
strDomain = [blue]"@some.domain.abc"[/blue]

Open App.Path & "\people.txt" For Input As #ff
Do While Not EOF(ff)
    Line Input #ff, strTextLine
    If Len(strSendTo) = 0 Then
        strSendTo = strTextLine & strDomain
    Else
        strSendTo = strSendTo & ";" & strTextLine & strDomain
    End If
Loop
Close #ff

[green]'Debug.Print strSendTo[/green]

Set objMessage = New CDO.Message

With objMessage
    .From = [blue]"You.Name@domain.net"[/blue]
    .BCC = strSendTo
    .Subject = [blue]"This is my Sybject Line."[/blue]
    .TextBody = vbNewLine[blue] & "Just a reminder..." & vbNewLine _
        & "Change your password."[/blue]
    With .Configuration.Fields
        .Item(CDO.cdoSMTPServer) = [blue]"VBNM.ABC.XYZ.JKL"[/blue]
        .Item(CDO.cdoSMTPServerPort) = 25
        .Item(CDO.cdoSendUsingMethod) = CDO.cdoSendUsingPort
        .Item(cdoSMTPConnectionTimeout) = 10
        .Update
    End With
    .Send
End With

Set objMessage = Nothing

End Sub

In VB6 in Project - Properties - General tab, in Startup Object select "Sub Main" which is the Sub in the code in the Module.

You would need to change all BLUE parts in the code.

Run it, make sure it works, compile it into EXE and schedule it to run every ... whatever you decide.

Have fun.

---- Andy
 
There is a nice little program I have used to automate sending emails from MS Outlook to individuals or groups.

It is called "sendnow".

Hope it helps.
 
Thank You Andrzejek, I'll let you know
 
Andrzejek,
Do the script work if the Outlook is closed and the user logged out ?
Thank You
 
Hello Jamessimon,

Works your program if Outlook is closed and the user logged out ?
And it is possible how it is looking like ?

Thank You and regards
 
>Do the script work if the Outlook is closed and the user logged out ?

Andrzejek's code has nothing to do with Outlook, so Outlook doesn't even have to be installed, let alone open or have a user logged in.
 

strongm is right (of course), but the best way to see how it works is.... to try it. it is only a few lines of code, a very few pieces of information to change, and you can just send a simple "Hello" to yourself to see if/how it works.

Give it a shot.

Have fun.

---- Andy
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top