Monthly Email (1 Viewer)

Kodo

"The Shoe"
Local time
Today, 13:23
Joined
Jan 20, 2004
Messages
707
It's actually easier than you think.

If you're using Windows 2000/XP/2003 it comes with an installable component that you can add during install of the OS or afterwards via add/remove in the control panel (add components). It's an option to select in there for installation. Once installed, you need only create the vbscript that uses CDONTS to send the mail. Here is an example.

http://www.devasp.com/Samples/mail.asp

Then, you go into your control panel again and set up a task scheduled item to launch the VBSCRIPT file at your desired times.

Note that the script must run on the same machine that SMTP is on.

Honestly, it doesn't get much easier than that.. I would hope that you give it a try and I can walk you through it on parts you get stuck with.
 

sariahdog

New member
Local time
Today, 13:23
Joined
May 19, 2004
Messages
9
Animated .gif

Hayley Baxter said:
Hi Kev

It was already an animated file which Fizzio found and Col passed onto me (better not take the credits here) I'm not sure how to make a standard image animated. Anyone else?

Hay

It's an animated .gif file, each movement is a separate gif file or "layer". You display each layer for about .5 seconds and then move to the next layer.

I use Adobe ImageReady but if you want a free program, there are a ton out there. If you do a search on download.com for image editing programs, I'm sure you can find something free.
 

Crash1hd

Registered CyberGeek
Local time
Today, 10:23
Joined
Jan 11, 2004
Messages
143
Kodo I just wanted to say your idea is genius :) if I do say so myself I was trying to think of a way that I could do the whole send out an automatic email every month or day based on data in a db like many big sites do IE birthdayalarms.com ext... :) and I dont know why I didnt think if useing the built in services in 2k3 or XP ext... :) I was wondering if you had a link for more info on how to create a service that is always running in the background ro task scheduler cause I can never seem to find it in xp!

For somereason I always thought there was a special program that ran well I guess in a sense there is

Also is there a way to do the same if you where running OSX or linux?
 

Kodo

"The Shoe"
Local time
Today, 13:23
Joined
Jan 20, 2004
Messages
707
Crash1hd said:
Kodo I just wanted to say your idea is genius :) if I do say so myself I was trying to think of a way that I could do the whole send out an automatic email every month or day based on data in a db like many big sites do IE birthdayalarms.com ext... :) and I dont know why I didnt think if useing the built in services in 2k3 or XP ext... :) I was wondering if you had a link for more info on how to create a service that is always running in the background ro task scheduler cause I can never seem to find it in xp!

For somereason I always thought there was a special program that ran well I guess in a sense there is

Also is there a way to do the same if you where running OSX or linux?

When it comes to Linux or OSX I am a complete moron, so I can't help you there, sorry.

Note that you must have the Task Scheduler service enabled in your services MMC.
Your Task Scheduler is in the control panel and is named "Sheduled Tasks". Open that up and add a task. Point the task to the vbscript file and give it the required intervals. That's all there is to it. So long as the PC is on and you set up the rights to the task properly (ie, running under admin) then there should be no issues with it running at the scheduled times. You don't need any special background services running, it's all part of the OS already.
 

Mark Wild

Registered User.
Local time
Today, 18:23
Joined
Apr 9, 2003
Messages
126
Adding multiple attachments

Does anyone know how to amend this code Hayley used to attach more than one file?
 

Nero

Shop smart, shop S-Mart
Local time
Today, 18:23
Joined
Jan 8, 2002
Messages
217
.Attachments = "C:\Your File1"
.Attachments = "C:\Your File2"
.Attachments = "C:\Your File3"
etc
 

Nero

Shop smart, shop S-Mart
Local time
Today, 18:23
Joined
Jan 8, 2002
Messages
217
If you have problems with the above then this works also.

.Attachments.Add "C:\Your File1"
.Attachments.Add "C:\Your File2"
.Attachments.Add "C:\Your File3"
etc

geraldcor,
This would probably have solved your problem also.
 

Mark Wild

Registered User.
Local time
Today, 18:23
Joined
Apr 9, 2003
Messages
126
Cheers Nero,

THis is giving the message that the object doesn't support this method. I was using a slightly different method (.Attachments.Add(strAttachment, olByReference), so when I use your example, its not working.

I don;t mind in the slightest which method I use, but I'm afraid I don't understand the code enough to know how to change it.

Cheers

Code:
Public Function Mailer(strSubject As String, strBody As String, _
    strImportance As String, strAttachment As String, strAttachment2 As String, strTo As String, strDisplayName As String)
    
    'sets up the paramenters required for an email and then communicates with outlook

Dim olkapps As Outlook.Application 'set the application
Dim olknamespaces As Outlook.NameSpace
Dim objmailitems As Outlook.MailItem ' and that it will be an email

Set olkapps = New Outlook.Application
Set olknamespaces = GetNamespace("MAPI")
Set objmailitems = olkapps.CreateItem(olMailItem)

With objmailitems
    .To = strTo
    .Subject = strSubject
    .Body = strBody
    .Importance = strImportance 'olImportanceHigh
        With .Attachments
                .Attachments = strAttachment
                .Attachments = strAttachment2
        [I]'.Attachments.Add(strAttachment, olByReference)[/I]
            '.Attachments.Add(strAttachment2, olByReference)
            .DisplayName = strDisplayName
        End With
    .Display ' display the email rather than just send it (.send if req'd)
End With

Set objmailitems = Nothing
Set olknamespaces = Nothing
Set olkapps = Nothing
 

Nero

Shop smart, shop S-Mart
Local time
Today, 18:23
Joined
Jan 8, 2002
Messages
217
Try this.
Code:
With objmailitems
    .To = strTo
    .Subject = strSubject
    .Body = strBody
    .Importance = strImportance 'olImportanceHigh
    .Attachments.Add(strAttachment, olByReference)
    .Attachments.Add(strAttachment2, olByReference)
    .Display
 
Last edited:

Mark Wild

Registered User.
Local time
Today, 18:23
Joined
Apr 9, 2003
Messages
126
No luck unfortunately. This was the solution that I had thought would work, but with both attachment references, the lines immediately go red.

If I tab one or the other out, it allows it, so it looks like .attachment can only be used once...

Any other thoughts?

Cheers,

M
 

Nero

Shop smart, shop S-Mart
Local time
Today, 18:23
Joined
Jan 8, 2002
Messages
217
Mark Wild said:
No luck unfortunately. This was the solution that I had thought would work, but with both attachment references, the lines immediately go red.

If I tab one or the other out, it allows it, so it looks like .attachment can only be used once...

Any other thoughts?

Cheers,

M
The
Code:
.Attachments.Add "FileName"
can be used many times.
I use this method in some code I wrote to transfer data from our AS400 and add it as a csv attachment in Outlook.
I don't use the olByReference though.
 

Mark Wild

Registered User.
Local time
Today, 18:23
Joined
Apr 9, 2003
Messages
126
THanks for your help Nero.

When I removed the With .attachment it allowed for more than one attachment.

All sorted!
 

Nero

Shop smart, shop S-Mart
Local time
Today, 18:23
Joined
Jan 8, 2002
Messages
217
Mark Wild said:
THanks for your help Nero.

When I removed the With .attachment it allowed for more than one attachment.

All sorted!

No problem!
Glad it's working.
 

hackett

New member
Local time
Today, 18:23
Joined
Sep 10, 2006
Messages
7
Email Automation

Hi Nero....great bit of email code...works beautifully! Is it possible using an alteration to this code to create breaks in the text of the email or to create paragraphs so that the email can be of a longer length and look more formatted?
 

Nero

Shop smart, shop S-Mart
Local time
Today, 18:23
Joined
Jan 8, 2002
Messages
217
Hi Hackett,

It's been a long time since I have done any Access stuff so I'm not sure on the formatting. I will have a look at it again and post back.
 

Nero

Shop smart, shop S-Mart
Local time
Today, 18:23
Joined
Jan 8, 2002
Messages
217
You'll have to test this but try vbCrLf in the subject code.
ie

.Body = "Text In Here" & vbCrLf & "Next Line of Text In Here" & vbCrLf & "Third Line In Here etc"
 

hackett

New member
Local time
Today, 18:23
Joined
Sep 10, 2006
Messages
7
Email Automation

Thanks....! Works a treat. What I did to creat the effect of a paragraph was to make the second set of quotes blank:

.Body = "Text In Here" & vbCrLf & " " & vbCrLf & "Third Line In Here etc"

Really appreciate your help!

Chris
 

Nero

Shop smart, shop S-Mart
Local time
Today, 18:23
Joined
Jan 8, 2002
Messages
217
No prob.
I'd forgotten how much I like Access. Ahh the good old days!:)
 

hackett

New member
Local time
Today, 18:23
Joined
Sep 10, 2006
Messages
7
Things are going well for OUTLOOK automation...just one thing eludes me....using this code there is a limit to the length of email message you can write. Is there a way of removing the limit so that I can write lengthier emails in OUTLOOK?

I've had a look generally on the forum and cannot find the solution...short of using completely different code

Chris
 

Nero

Shop smart, shop S-Mart
Local time
Today, 18:23
Joined
Jan 8, 2002
Messages
217
I've never really had the need to test the limit on the email. It is just used to send a few lines. How much are you trying to put into the email body ?
 

Users who are viewing this thread

Top Bottom