Send email to users get from a csv file. RRS feed

  • General discussion

  • Hello

    I need a script to send an email to users get from a csv file. It is going to be a Reminder for our employees. So far I got this

    $userList = import-csv "C:\Shared\users.csv"
    $subject = "Here is your Temporary Password."  
    $smtp = "exchange.###.com"  
    $username = “put the right one”  
    $password = convertTo-secureString –string “added a pass.” –asPlainText –force  
    $creds = new-object System.Management.Automation.PSCredential($username,$password)   

    foreach ($user IN $userList) {  
        $body = "Your temporary password is " + $user.password  
        Send-MailMessage -to my email -Subject $subject -body $body -SmtpServer $smtp -from support email -Credential $creds  

    But I am having

    Send-MailMessage : Mailbox unavailable. The server response was: 5.7.606 Access denied, banned sending IP []. To request removal from this list please visit https://sender.office.com/ and follow the
    directions. For more information please go to  http://go.microsoft.com/fwlink/?LinkID=526655 (AS16012609) [VE1EUR03FT038.eop-EUR03.prod.protection.outlook.com]
    At line:14 char:5
    +     Send-MailMessage -to v.mircheva@televic.com -Subject $subject -bo ...
    +     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        + CategoryInfo          : InvalidOperation: (System.Net.Mail.SmtpClient:SmtpClient) [Send-MailMessage], SmtpFailedRecipientException
        + FullyQualifiedErrorId : SmtpException,Microsoft.PowerShell.Commands.SendMailMessage

    Can you help me ?

    • Changed type Bill_Stewart Tuesday, April 14, 2020 1:30 PM
    • Moved by Bill_Stewart Tuesday, April 14, 2020 1:30 PM User didn't read error message
    Friday, August 23, 2019 8:11 PM

All replies

  • Your IP has been blacklisted. Follow the instructions in the error message.

    This has nothing to do with scripting and cannot be resolved by anyone but you following the instructions.


    Friday, August 23, 2019 8:20 PM
  • First, try reading the error message

    -- Bill Stewart [Bill_Stewart]

    Monday, August 26, 2019 4:44 PM