A Microsoft Outlook email forum. Outlook Banter

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » Outlook Banter forum » Microsoft Outlook Email Newsgroups » Outlook and VBA
Site Map Home Register Authors List Search Today's Posts Mark Forums Read Web Partners

Autosend Email With Attachments



 
 
Thread Tools Search this Thread Display Modes
  #1  
Old June 28th 06, 04:03 PM posted to microsoft.public.outlook.program_vba
[email protected]
external usenet poster
 
Posts: 9
Default Autosend Email With Attachments

Hey guys i'm sure this has been posted but i just couldn't find it. I'm
new to VB but was told it's the easiest way to do what i need. I
usually program in java and several others but here goes. I need a
program to auto send an email once a night with an attachment. The
attachment would be in the form xx_xxxx_27062006.csv where 27062006 is
the date 27/06/2006. I would need the VB program to pull data from the
system clock and add the date as a variable in the file_path string.
The second part i need is the automated sending of the email with the
attachment. This would be the hardest part of the program (i would
think, but hey what do i know). The third part i would do is to auto
run this program at about 12 midnight, so i would just put it into
windows task scheduler. Any ideas to point me in the right direction or
any reading material would be appreciated.

Thanks,
Kevin

  #2  
Old June 28th 06, 06:20 PM posted to microsoft.public.outlook.program_vba
[email protected]
external usenet poster
 
Posts: 9
Default Autosend Email With Attachments

I actually got the email aspect running now all i need is the date addin

  #3  
Old June 28th 06, 06:26 PM posted to microsoft.public.outlook.program_vba
Eric Legault [MVP - Outlook]
external usenet poster
 
Posts: 830
Default Autosend Email With Attachments

You're out of luck - you cannot automate the Outlook Object Model from a
Scheduled Task:

The Outlook Object Model is unsuitable to run in a Windows service:
http://support.microsoft.com/default...b;en-us;237913

You'd need to use CDO instead.

--
Eric Legault (Outlook MVP, MCDBA, MCTS: Messaging & Collaboration)
Try Picture Attachments Wizard for Outlook:
http://www.collaborativeinnovations.ca
Blog: http://blogs.officezealot.com/legault/


" wrote:

Hey guys i'm sure this has been posted but i just couldn't find it. I'm
new to VB but was told it's the easiest way to do what i need. I
usually program in java and several others but here goes. I need a
program to auto send an email once a night with an attachment. The
attachment would be in the form xx_xxxx_27062006.csv where 27062006 is
the date 27/06/2006. I would need the VB program to pull data from the
system clock and add the date as a variable in the file_path string.
The second part i need is the automated sending of the email with the
attachment. This would be the hardest part of the program (i would
think, but hey what do i know). The third part i would do is to auto
run this program at about 12 midnight, so i would just put it into
windows task scheduler. Any ideas to point me in the right direction or
any reading material would be appreciated.

Thanks,
Kevin


  #4  
Old June 28th 06, 07:23 PM posted to microsoft.public.outlook.program_vba
[email protected]
external usenet poster
 
Posts: 9
Default Autosend Email With Attachments

I know that you know a hell of alot more than me, but i just sent
myself an email via the script. It's a basic code to send out an email
in a .vbs which was set to run via windows task scheduler.

The only problem i have now is concatenating the date to a string for
use inside the find file. I need it in format 28062006 for "ddmmyyyy"
and format(now, "ddmmyyyy") and now.toString("ddmmyyyy") both don't
work. Any suggestions?


Eric wrote:

You're out of luck - you cannot automate the Outlook Object Model from a
Scheduled Task:

The Outlook Object Model is unsuitable to run in a Windows service:
http://support.microsoft.com/default...b;en-us;237913

You'd need to use CDO instead.

--
Eric Legault (Outlook MVP, MCDBA, MCTS: Messaging & Collaboration)
Try Picture Attachments Wizard for Outlook:
http://www.collaborativeinnovations.ca
Blog: http://blogs.officezealot.com/legault/


" wrote:

Hey guys i'm sure this has been posted but i just couldn't find it. I'm
new to VB but was told it's the easiest way to do what i need. I
usually program in java and several others but here goes. I need a
program to auto send an email once a night with an attachment. The
attachment would be in the form xx_xxxx_27062006.csv where 27062006 is
the date 27/06/2006. I would need the VB program to pull data from the
system clock and add the date as a variable in the file_path string.
The second part i need is the automated sending of the email with the
attachment. This would be the hardest part of the program (i would
think, but hey what do i know). The third part i would do is to auto
run this program at about 12 midnight, so i would just put it into
windows task scheduler. Any ideas to point me in the right direction or
any reading material would be appreciated.

Thanks,
Kevin



  #5  
Old June 28th 06, 08:08 PM posted to microsoft.public.outlook.program_vba
Eric Legault [MVP - Outlook]
external usenet poster
 
Posts: 830
Default Autosend Email With Attachments

I'm sure you got it to work using shellexecute or something with the mailto
command, but it still doesn't change the fact that you cannot use the Outlook
Object Model inside an application that's run via the Task Scheduler. The
code you used did not use any Outlook objects (eg. Outlook.Application,
Outlook.MailItem, etc.), but you'd need to use the OOM if you wanted to
insert attachments.

Try Format(Date(), "ddmmyyyy").

--
Eric Legault (Outlook MVP, MCDBA, MCTS: Messaging & Collaboration)
Try Picture Attachments Wizard for Outlook:
http://www.collaborativeinnovations.ca
Blog: http://blogs.officezealot.com/legault/


" wrote:

I know that you know a hell of alot more than me, but i just sent
myself an email via the script. It's a basic code to send out an email
in a .vbs which was set to run via windows task scheduler.

The only problem i have now is concatenating the date to a string for
use inside the find file. I need it in format 28062006 for "ddmmyyyy"
and format(now, "ddmmyyyy") and now.toString("ddmmyyyy") both don't
work. Any suggestions?


Eric wrote:

You're out of luck - you cannot automate the Outlook Object Model from a
Scheduled Task:

The Outlook Object Model is unsuitable to run in a Windows service:
http://support.microsoft.com/default...b;en-us;237913

You'd need to use CDO instead.

--
Eric Legault (Outlook MVP, MCDBA, MCTS: Messaging & Collaboration)
Try Picture Attachments Wizard for Outlook:
http://www.collaborativeinnovations.ca
Blog: http://blogs.officezealot.com/legault/


" wrote:

Hey guys i'm sure this has been posted but i just couldn't find it. I'm
new to VB but was told it's the easiest way to do what i need. I
usually program in java and several others but here goes. I need a
program to auto send an email once a night with an attachment. The
attachment would be in the form xx_xxxx_27062006.csv where 27062006 is
the date 27/06/2006. I would need the VB program to pull data from the
system clock and add the date as a variable in the file_path string.
The second part i need is the automated sending of the email with the
attachment. This would be the hardest part of the program (i would
think, but hey what do i know). The third part i would do is to auto
run this program at about 12 midnight, so i would just put it into
windows task scheduler. Any ideas to point me in the right direction or
any reading material would be appreciated.

Thanks,
Kevin




  #6  
Old June 28th 06, 10:36 PM posted to microsoft.public.outlook.program_vba
Dan Mitchell
external usenet poster
 
Posts: 58
Default Autosend Email With Attachments

=?Utf-8?B?RXJpYyBMZWdhdWx0IFtNVlAgLSBPdXRsb29rXQ==?=
wrote in
:
it still doesn't change the fact that you cannot
use the Outlook Object Model inside an application that's run via the
Task Scheduler.


Strictly speaking, you _can_ run it, it just most likely won't work
properly. The KB article quotes four problems, which you can work around
by:

1. leaving the user that's meant to be running the Outlook code always
logged in
2. making sure the logged-in user isn't running Outlook when the
scheduled stuff is meant to fire off.
3. uh.. being lucky? heh. If it's working for the OP, then presumably
the particular mapi spooler interactions in question are going okay
4. writing code so it doesn't pop up any dialogs.

(wow, http://support.microsoft.com/kb/259971/ has an ingenious, but
also very ghastly hack to get around that last problem)

Point 3 is the obvious killer, and 1 and 2 basically clobber any sort
of normal run-as-a-service stuff, but in very particular, carefully
controlled, environments, it might be possible to get things to work.

It's sort of like coding with CDO1.21/ExMAPI and .Net, except the other
way around -- OOM from a service probably won't work, but occasionally
may mysteriously succeed; CDO1.21 will probably work okay from .Net, but
occasionally will mysteriously fail.

In general, though, it's much better to use CDO1.21/one of the other
CDOs/ExMAPI.

-- dan


  #7  
Old June 28th 06, 10:40 PM posted to microsoft.public.outlook.program_vba
Sue Mosher [MVP-Outlook]
external usenet poster
 
Posts: 11,651
Default Autosend Email With Attachments

I don't even think that hack for #4 will work on the most recent versions.

I'd use CDO for Windows to do this if it were my project.

--
Sue Mosher, Outlook MVP
Author of Configuring Microsoft Outlook 2003
http://www.turtleflock.com/olconfig/index.htm
and Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers
http://www.outlookcode.com/jumpstart.aspx

"Dan Mitchell" wrote in message 8.16...
=?Utf-8?B?RXJpYyBMZWdhdWx0IFtNVlAgLSBPdXRsb29rXQ==?=
wrote in
:
it still doesn't change the fact that you cannot
use the Outlook Object Model inside an application that's run via the
Task Scheduler.


Strictly speaking, you _can_ run it, it just most likely won't work
properly. The KB article quotes four problems, which you can work around
by:

1. leaving the user that's meant to be running the Outlook code always
logged in
2. making sure the logged-in user isn't running Outlook when the
scheduled stuff is meant to fire off.
3. uh.. being lucky? heh. If it's working for the OP, then presumably
the particular mapi spooler interactions in question are going okay
4. writing code so it doesn't pop up any dialogs.

(wow, http://support.microsoft.com/kb/259971/ has an ingenious, but
also very ghastly hack to get around that last problem)

Point 3 is the obvious killer, and 1 and 2 basically clobber any sort
of normal run-as-a-service stuff, but in very particular, carefully
controlled, environments, it might be possible to get things to work.

It's sort of like coding with CDO1.21/ExMAPI and .Net, except the other
way around -- OOM from a service probably won't work, but occasionally
may mysteriously succeed; CDO1.21 will probably work okay from .Net, but
occasionally will mysteriously fail.

In general, though, it's much better to use CDO1.21/one of the other
CDOs/ExMAPI.

-- dan


 




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Email Attachments Neilo Outlook Express 4 June 5th 06 08:33 PM
How to view all attachments in 1 email at once? jhciii Outlook - Installation 1 May 14th 06 01:56 AM
Sending email attachments NEIL BLEWITT Outlook Express 1 March 22nd 06 07:40 PM
Email attachments are missing chelley55 Outlook Express 4 March 3rd 06 01:09 AM
Autosend every Friday Brian Outlook - General Queries 1 January 19th 06 05:12 PM


All times are GMT +1. The time now is 12:26 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.Search Engine Friendly URLs by vBSEO 2.4.0
Copyright ©2004-2025 Outlook Banter.
The comments are property of their posters.