Is there a way to schedule a mail to be sent each day on a specific time with a file in the UNC path.

Hi,

Is there a way to schedule a mail to be sent each day on a specific time with a file in the UNC path.
This file is daily changed . Is there any way to each day send a mail with this file as attachment to some users.

its a xlsm file which has to be mailed.

Regards
Sharath
LVL 11
bsharathAsked:
Who is Participating?
 
mredfelixConnect With a Mentor Commented:
Try something in Vb script in the same UNC path
Dim objOutl
Set objOutl = CreateObject("Outlook.Application")
Set objMailItem = objOutl.CreateItem(olMailItem)
'comment the next line if you do not want to see the outlook window
objMailItem.Display
strEmailAddr  = "test@test.com"
objMailItem.Recipients.Add strEmailAddr
objMailItem.Body = "Hi"
objMailItem.Attachments.Add "file.xml"
objMailItem.Send
Set objMailItem = nothing
Set objOutl = nothing

Open in new window

0
 
bsharathAuthor Commented:
I get this

I have the file name mentioned and have the vbs in the same folder where the file is
---------------------------
Windows Script Host
---------------------------
Script:      D:\Mail.vbs
Line:      9
Char:      1
Error:      Cannot find this file. Verify the path and file name are correct.
Code:      80070002
Source:       Microsoft Office Outlook

---------------------------
OK  
---------------------------
0
 
ChizlConnect With a Mentor Commented:
Line 9 has to have the full path of the file your attaching.   However I think it doesn't support UNC.   that being said, You have to map out the folder to a drive, which you can do in VBS as well before you run the above, then disconnect the drive before exiting.    

http://www.experts-exchange.com/Programming/Languages/Visual_Basic/VB_Script/Q_23065351.html

However, this script does email, but you have to use (AT) command line to schedule it, or you can manually do it through Windows Scheduler.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.