Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

send email on schedulle

Posted on 2014-02-04
15
Medium Priority
?
1,002 Views
Last Modified: 2014-02-04
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
Comment
Question by:ger2111
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 9
  • 6
15 Comments
 
LVL 20

Expert Comment

by:n2fc
ID: 39831905
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
 

Author Comment

by:ger2111
ID: 39832095
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
 
LVL 20

Expert Comment

by:n2fc
ID: 39832104
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
Learn Veeam advantages over legacy backup

Every day, more and more legacy backup customers switch to Veeam. Technologies designed for the client-server era cannot restore any IT service running in the hybrid cloud within seconds. Learn top Veeam advantages over legacy backup and get Veeam for the price of your renewal

 

Author Comment

by:ger2111
ID: 39832107
running the script on the exchange server -

How do I validate certificates - -

TYTYTY
0
 
LVL 20

Expert Comment

by:n2fc
ID: 39832117
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
 

Author Comment

by:ger2111
ID: 39832126
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
 
LVL 20

Expert Comment

by:n2fc
ID: 39832142
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
 

Author Comment

by:ger2111
ID: 39832144
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
 
LVL 20

Accepted Solution

by:
n2fc earned 2000 total points
ID: 39832161
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
 

Author Comment

by:ger2111
ID: 39832176
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
 

Author Comment

by:ger2111
ID: 39832177
ah, i see it now! my apologies
0
 

Author Comment

by:ger2111
ID: 39832181
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
 
LVL 20

Expert Comment

by:n2fc
ID: 39832206
1) recipients separated by comma (not semicolon)

2) I believe the extension for powershell scripts is ".ps1"
0
 

Author Comment

by:ger2111
ID: 39832238
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
 

Author Closing Comment

by:ger2111
ID: 39832297
cracked it, many thanks for your timely assistance throughout. Much appreciated,
Ger
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Windocks is an independent port of Docker's open source to Windows.   This article introduces the use of SQL Server in containers, with integrated support of SQL Server database cloning.
When trying to connect from SSMS v17.x to a SQL Server Integration Services 2016 instance or previous version, you get the error “Connecting to the Integration Services service on the computer failed with the following error: 'The specified service …
Via a live example, show how to shrink a transaction log file down to a reasonable size.
Viewers will learn how to use the UPDATE and DELETE statements to change or remove existing data from their tables. Make a table: Update a specific column given a specific row using the UPDATE statement: Remove a set of values using the DELETE s…

722 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question