Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

send email on schedulle

Posted on 2014-02-04
15
Medium Priority
?
1,027 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
  • 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
NFR key for Veeam Agent for Linux

Veeam is happy to provide a free NFR license for one year.  It allows for the non‑production use and valid for five workstations and two servers. Veeam Agent for Linux is a simple backup tool for your Linux installations, both on‑premises and in the public cloud.

 

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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Are you looking for the options available for exporting EDB files to PST? You may be confused as they are different in different Exchange versions. Here, I will discuss some options available.
There can be many situations demanding the conversion of Outlook OST files to PST format and as such, there is no shortage of automated tools to perform this conversion. However, what makes Stellar OST to PST converter stand above the rest? Let us e…
This video shows how to quickly and easily add an email signature for all users on Exchange 2016. The resulting signature is applied on a server level by Exchange Online. The email signature template has been downloaded from: www.mail-signatures…
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an anti-spam), the admin…
Suggested Courses

971 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