GMJ29
asked on
Send an automatic scheduled email with an attachment on a weekly basis
We have an excel document that needs to be sent via email automatically once a week. We have Windows Server 2003, Outlook 2003 and Exchange 2003. We don't want to install and third-party software or any new add-ins for Outlook. Can someone tell me how we can accomplish this?
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
As Access is not required for this solution, that should not be a problem. The only reference to Access in the article mentions that code which allows you to automatically send an email is available in an article about Access, and you can use that code along with the other steps in the article I referenced to automatically send a message at a predefined time.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
traval - I'm not sure what to do with the code. I put it into an asp page, but am getting a whole slew of errors. Can you explain in a little more detail what needs to be done?
BlueDevilFan - what can we do as far as macros are concerned?
BlueDevilFan - what can we do as far as macros are concerned?
ASKER
ok guys, i got the code into an Outlook Macro and it works if I run it from the VB editor. How do I make this schedule to run weekly?
ASKER
I'm looking at the knowledge base article that traval posted and see that you can automate the vb script using cdo - I have no idea how to do this. Can someone please give me a little more input on how to automate this? Any further help on this is greatly appreciated
GMJ29,
In answer to your question about what can we do with macros, the answer is "most anything". I don't use CDO much so I can't help with that. I can create a simple macro that will do this though if that's an alternative.
In answer to your question about what can we do with macros, the answer is "most anything". I don't use CDO much so I can't help with that. I can create a simple macro that will do this though if that's an alternative.
ASKER
well, i developed a macro that sends the mail with the attachment, but i don't know how to schedule it to run at a predetermined time
Take a look at this question: https://www.experts-exchange.com/questions/21286755/Email-an-email-to-alert-of-a-product-change.html In it I used an Outlook Task Reminder to trigger a process.
ASKER
Here it is - I somehow got it to work. The usage after the code is compiled is:
xxx.exe [sender address] [recipient address] [subject] [body] [attachment path]
Imports System.Web.Mail
Module Module1
Public Sub Main(ByVal args As String())
Dim oMsg As MailMessage = New MailMessage
' TODO: Replace with sender e-mail address.
oMsg.From = args(0)
' TODO: Replace with recipient e-mail address.
oMsg.To = args(1)
oMsg.Subject = args(2)
' SEND IN HTML FORMAT (comment this line to send plain text).
oMsg.Body = args(3)
'HTML Body (remove HTML tags for plain text).
'oMsg.Body = "<HTML><BODY><B>Hello World!</B></BODY></HTML>"
' ADD AN ATTACHMENT.
' TODO: Replace with path to attachment.
Dim sFile As String = args(4)
Dim oAttch As MailAttachment = New MailAttachment(sFile, MailEncoding.Base64)
'oMsg.Attachments.Add(oAtt ch)
' TODO: Replace with the name of your remote SMTP server.
SmtpMail.SmtpServer = "xxx"
SmtpMail.Send(oMsg)
oMsg = Nothing
'oAttch = Nothing
End Sub
End Module
xxx.exe [sender address] [recipient address] [subject] [body] [attachment path]
Imports System.Web.Mail
Module Module1
Public Sub Main(ByVal args As String())
Dim oMsg As MailMessage = New MailMessage
' TODO: Replace with sender e-mail address.
oMsg.From = args(0)
' TODO: Replace with recipient e-mail address.
oMsg.To = args(1)
oMsg.Subject = args(2)
' SEND IN HTML FORMAT (comment this line to send plain text).
oMsg.Body = args(3)
'HTML Body (remove HTML tags for plain text).
'oMsg.Body = "<HTML><BODY><B>Hello World!</B></BODY></HTML>"
' ADD AN ATTACHMENT.
' TODO: Replace with path to attachment.
Dim sFile As String = args(4)
Dim oAttch As MailAttachment = New MailAttachment(sFile, MailEncoding.Base64)
'oMsg.Attachments.Add(oAtt
' TODO: Replace with the name of your remote SMTP server.
SmtpMail.SmtpServer = "xxx"
SmtpMail.Send(oMsg)
oMsg = Nothing
'oAttch = Nothing
End Sub
End Module
ASKER
You all gave me some good help - here's the points
ASKER