locked
Creating/updating a transport rule from a text file. RRS feed

  • Question

  • Good morning, I'm hoping you guys and gals can help me come up with a solution. 

    What I would like to do is create a script that will import a list of email address from a .csv into a transport rule under the "sent to" condition.  I would like to be able to then create a scheduled task and have this script update the list every few hours or so. 

    Is this possible? 

    Friday, October 19, 2012 1:05 PM

Answers

  • Hmm, try this.

    >$SentToArray = get-content C:\senttolist.txt

    >set-transportrule "Do not send" -SentTo $SentToArray

    Populate the senttolist.txt file with your email addresses.  You may even be able to populate this list from SQL or another database.

    Does this happen to be for an opt-out system on email campaigns?

    • Marked as answer by donaldkbart Friday, October 19, 2012 5:45 PM
    Friday, October 19, 2012 5:34 PM

All replies

  • Are these internal or external addresses?

    [string](0..33|%{[char][int](46+("686552495351636652556262185355647068516270555358646562655775 0645570").substring(($_*2),2))})-replace " "

    Friday, October 19, 2012 2:25 PM
  • external

    Friday, October 19, 2012 2:28 PM
  • Hmm, try this.

    >$SentToArray = get-content C:\senttolist.txt

    >set-transportrule "Do not send" -SentTo $SentToArray

    Populate the senttolist.txt file with your email addresses.  You may even be able to populate this list from SQL or another database.

    Does this happen to be for an opt-out system on email campaigns?

    • Marked as answer by donaldkbart Friday, October 19, 2012 5:45 PM
    Friday, October 19, 2012 5:34 PM
  • It is recommended to post the question on scrip in Exchange Development forum where there are more developers. Your understanding would be appreciated.

    Fiona Liao

    TechNet Community Support

    Tuesday, November 6, 2012 3:23 AM
    Moderator