?
Solved

Issues sending emails from script

Posted on 2016-07-26
5
Medium Priority
?
59 Views
1 Endorsement
Last Modified: 2016-07-31
I had this question after viewing Notify AD users by sending email to them before their password gets expired.

I have used the script above to create a reminder email to send out to users.

the trouble is that i keep getting errors when sending the email, saying error message like below

Error Sending Email to xxxx using the email xxxxx Failed item is . The error message was Exception calling "Send" with "1" argument(s): "Failure sending mail."

I am trying to run the powershell script on the exchange server itself, so am not sure what the issue is.

any ideas?
Password_Change_Notification.txt
1
Comment
Question by:Steven Reid
[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
  • 2
5 Comments
 
LVL 70

Accepted Solution

by:
Qlemo earned 1000 total points
ID: 41729249
Exchange is not part of the equation. The script uses SMTP to send a mail message, and the Send() method can fail because of a lot of reasons. Check that the corresponding variables at the script head are set correctly, including password.
2
 

Author Comment

by:Steven Reid
ID: 41736834
For others information, turned out to be the fact that the saved password that was being used was generated under one user account, but I was using a different user account to read that password.  so was not being decrypted properly.

When i ran it under the same account, it was all good.

Thanks
1
 
LVL 8

Assisted Solution

by:Senior IT System Engineer
Senior IT System Engineer earned 1000 total points
ID: 41736838
Steven,


Qlemo thread should be the asnwer.
0
 
LVL 8

Expert Comment

by:Senior IT System Engineer
ID: 41736862
Here's the PowerShell script for your testing in case you need it:

Send-MailMessage -From "Sender@PowerShell.domain.com" -To "yourself@domain.com" -Subject "Testing email relay" -Body "Anonymous Email Relay" -SmtpServer "SMTP.domain.com" -DeliveryNotificationOption OnFailure -Verbose

Open in new window

1

Featured Post

Is Your AD Toolbox Looking More Like a Toybox?

Managing Active Directory can get complicated.  Often, the native tools for managing AD are just not up to the task.  The largest Active Directory installations in the world have relied on one tool to manage their day-to-day administration tasks: Hyena. Start your trial today.

Question has a verified solution.

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

This article lists the top 5 free OST to PST Converter Tools. These tools save a lot of time for users when they want to convert OST to PST after their exchange server is no longer available or some other critical issue with exchange server or impor…
This article explains how to install and use the NTBackup utility that comes with Windows Server.
The basic steps you have just learned will be implemented in this video. The basic steps are shown to configure an Exchange DAG in a live working Exchange Server Environment and manage the same (Exchange Server 2010 Software is used in a Windows Ser…
There are cases when e.g. an IT administrator wants to have full access and view into selected mailboxes on Exchange server, directly from his own email account in Outlook or Outlook Web Access. This proves useful when for example administrator want…
Suggested Courses

801 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