Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1045
  • Last Modified:

send email on schedulle

Experts Exchange > Other > Lounge > Send Email On Schedule
Question
View SolutionAsk A New Question
send email on schedule
Asked by: ger2111
Solved by: captain
Hi,
I want to send notification emails on a fortnightly basis in a specific time window to a select number of users. I do not want to use outlook for this purpose , is there a way I can do this within exchange 2010 or can I use DB Mail in SQL 2005. Or is there some third party software that you can reccoment that will achieve same.

Thanks,
Ger
0
ger2111
Asked:
ger2111
  • 9
  • 6
1 Solution
 
n2fcCommented:
See the following article for a sample PowerShell script to send emails...

http://www.howtogeek.com/120011/stupid-geek-tricks-how-to-send-email-from-the-command-line-in-windows-without-extra-software/

Just create the appropriate script & use the task scheduler to run it every couple'a weeks...
0
 
ger2111Author Commented:
working with this, seeing

The remote certificate is invalid according to the validation procedure when I try to run the script,

think its to do with out exchange certificates, is there a way around this?
thanks,
Ger
0
 
n2fcCommented:
You will need to manually add the certificate as valid to the machine running the script as it is probably self-signed and not from a recognized certification authority.
0
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 
ger2111Author Commented:
running the script on the exchange server -

How do I validate certificates - -

TYTYTY
0
 
n2fcCommented:
When  you get the certificate error, check to see the cause...
It will either be due to expired (so renew it) or due to unrecognized certification authority (so you must manually add to trusted cert db)
0
 
ger2111Author Commented:
thanks for this -
the error in full:
Exception calling "Send" with "4" argument(s): "The remote certificate is invalid according to the validation procedur
."
At line:1 char:17
+ $SMTPClient.Send <<<< ($EmailFrom, $EmailTo, $Subject, $Body)
    + CategoryInfo          : NotSpecified: (:) [], MethodInvocationException
    + FullyQualifiedErrorId : DotNetMethodException
0
 
n2fcCommented:
Again, probably due to a self-signed certificate on the server...  (but check this)...

See:
http://blogs.msdn.com/b/jpsanders/archive/2009/09/16/troubleshooting-asp-net-the-remote-certificate-is-invalid-according-to-the-validation-procedure.aspx

for a procedure (step 1) to verify & correct this error...
0
 
ger2111Author Commented:
the first line of step one has me -
One super handy and technical tool to help you do this first step is Internet Explorer.  Simply try to hit the same URL that your ASP.NET web application tries to hit when it gets this error.  For example, type in to the browser the path to the .asmx file and see what Internet Explorer says about the certificate.

dont see any url in the error, using ie and browsing to https://exchangeserver returns the standard IIS splash screen.

stuck at this point..
0
 
n2fcCommented:
If you are using a local server (i.e. "exchangeserver") and it is setup to accept SMTP on port 25 as well, try NOT using SSL and port 25 to avoid the need for certificates altogether...

I think by following the example too literally (the gmail example shows using SSL only because gmail requires it) it is overly complicated for you...

See if you can get around this by using standard port 25 WITHOUT SSL!
0
 
ger2111Author Commented:
here is my script: have changed to port 25 but do not see where i can change to not use SSL:

Thanks again,

$EmailFrom = "payroll@domain.com"
$EmailTo = "user@domain.com"
$Subject = "PAYROLL AUTHORISATION"
$Body = "This is an auto reminder to please ensure Payroll File is AUTHORISED today.”
$SMTPServer = "exchangeserver"
$SMTPClient = New-Object Net.Mail.SmtpClient($SmtpServer, 25)
$SMTPClient.EnableSsl = $true
$SMTPClient.Credentials = New-Object System.Net.NetworkCredential(“domain\payroll”, “**********”);
$SMTPClient.Send($EmailFrom, $EmailTo, $Subject, $Body)
0
 
ger2111Author Commented:
ah, i see it now! my apologies
0
 
ger2111Author Commented:
wonderful, i have it working now, last couple of questions,

if i want to add multiple reciepients just seperate with a semi colon right?

and another quich one, how do i save the script, i mean, copy into notepad, what is the extension i need to add?


Thanks so much.
0
 
n2fcCommented:
1) recipients separated by comma (not semicolon)

2) I believe the extension for powershell scripts is ".ps1"
0
 
ger2111Author Commented:
still not getting the emails out to multiple users, can you provide correct syntak for two users and I will follow your lead :

I have "user@domain.com","user2@domain.com" etc but it doesnt like that, some searching would suggest that I may need to dd a $recipients somethere in the script?


Nearly there
Thanks again,
0
 
ger2111Author Commented:
cracked it, many thanks for your timely assistance throughout. Much appreciated,
Ger
0

Featured Post

Microsoft Certification Exam 74-409

Veeam® is happy to provide the Microsoft community with a study guide prepared by MVP and MCT, Orin Thomas. This guide will take you through each of the exam objectives, helping you to prepare for and pass the examination.

  • 9
  • 6
Tackle projects and never again get stuck behind a technical roadblock.
Join Now