Automated Daily Email to All Users
Hi,What would be the best way to send an automated email to all users each day? Our organisation had an old UNIX email system previously that sent a reminder email to check noticeboard items on our intranet. I was wondering how I can do the same thing with Exchange 2007?Thanks,Richard
July 16th, 2008 7:26am
You could have the same result with setting up a scheduled task to send the message. Below is the vbscript you would need to modify to create the script to call with the scheduled task:
Sending Email from a Script
Demonstration script that uses CDO to send email from a computer where the SMTP Service has been installed.Set objEmail = CreateObject("CDO.Message")
objEmail.From = "monitor1@fabrikam.com"
objEmail.To = "admin1@fabrikam.com"
objEmail.Subject = "Atl-dc-01 down"
objEmail.Textbody = "Atl-dc-01 is no longer accessible over the network."
objEmail.Send
Sending Email without Installing the SMTP Service
Demonstration script that uses CDO to send email from a computer where the SMTP Service has not been installed. Replace the name smarthost with the name of your SMTP server.Set objEmail = CreateObject("CDO.Message")
objEmail.From = "admin1@fabrikam.com"
objEmail.To = "admin2@fabrikam.com"
objEmail.Subject = "Server down"
objEmail.Textbody = "Server1 is no longer accessible over the network."
objEmail.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
objEmail.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/smtpserver") = _
"smarthost"
objEmail.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25
objEmail.Configuration.Fields.Update
objEmail.Send
Hope this hleps,
Jeremy
Free Windows Admin Tool Kit Click here and download it now
July 16th, 2008 7:11pm
Hi Rich,
And here is the PowerShell script for sending mail.
Procedure:
Create below two filesand put it in a folder & create a task scheduler to run MailSend.CMD everyday on Exchange Server.
========================MailSend.CMD========================
powershell -command "& {C:\PathOFScript\MailSend.ps1 }"
========================MailSend.CMD========================
========================MailSend.PS1========================
$emailFrom = "user@yourdomain.com"
$emailTo = "user@yourdomain.com"
$subject = "your subject"
$body = "your body"
$smtpServer = "your smtp server"
$smtp = new-object Net.Mail.SmtpClient($smtpServer)
$smtp.Send($emailFrom, $emailTo, $subject, $body)
========================MailSend.PS1========================
Hope this helps you to automating it!!!
July 16th, 2008 7:35pm
Thanks everyone!Should be able to use either the VBS or Powershell to do what I need.Kind regards,Richard
Free Windows Admin Tool Kit Click here and download it now
July 17th, 2008 5:15am