locked
Relay restrictions in SMTP server RRS feed

  • Question

  • User1787869660 posted

    Hi,

    I need to check  whether the email server allows “relaying” programmatically in C#.net . I need to check IP: 127.0.0.1 may relay through virtula server. (default SMTP Virtual Server--> properties-->Access-->Relay)

     

    Can any one please help me in this regard.

     

    Thanks

    Sivakumar

    Tuesday, March 18, 2008 7:49 AM

Answers

  • User989702501 posted

    Well, i'm not a dev guy. if you are looking for the config, I can tell which key to look in to.. then you can use err. system.directoryservices to access the IPSecurity metabase key under lm/smtpsvc/ node.

    • Marked as answer by Anonymous Tuesday, September 28, 2021 12:00 AM
    Friday, March 21, 2008 12:18 AM
  • User1787869660 posted

    Hi Bernard,

    Thanks alot for your help. It worked out for me.

     

    Thanks

    Siva.

    • Marked as answer by Anonymous Tuesday, September 28, 2021 12:00 AM
    Sunday, March 23, 2008 2:07 AM
  • User1073881637 posted

    Here is one way using code.  You'll need to get the IISOLE.dll which is the COM interface.

    1) Download VB 2008 express (search for this link) 

    2) Go to codeplex and download this project, extract the OLEDLL.dll 
    http://www.codeplex.com/SLK

    3) Make a project in VB2008 express

    4) Make a reference to the IISOLE.dll

    5) Paste this code into your main and run

    Dim objValue As New DirectoryEntry("IIS://localhost/smtpsvc/1")
    Dim objIPSec As IISOle.IISIPSecurity = objValue.Properties("RelayIpList").Value
    objIPSec.IPGrant = New Object() {"192.168.55.50", "192.168.22.20"}
    objValue.Properties("RelayIpList").Value = objIPSec
    objValue.CommitChanges()

    Here is a reference of the entire IISOLE.dll. 
    http://www.webtropy.com/articles/art14-2.asp?Interop=IISOle

    • Marked as answer by Anonymous Tuesday, September 28, 2021 12:00 AM
    Wednesday, June 4, 2008 11:46 PM

All replies

  • User989702501 posted

    Errr. if you have set it to local ip. then either use manual telnet port 25 or text file in pickup folder to check if the mail is sending out. You can test remote relay using telnet as well.

    what do you mean by programmatically? you can compose email via system.web.mail etc

    Wednesday, March 19, 2008 2:04 AM
  • User1787869660 posted

    Hi Bernard,

    Thanks for your reply. Actually i am developing a configuration tool which has to check whether a perticular SMTP server  (ip as 127.0.0.1) is allowed relaying or not. We can see that by clicking Default SMTP vertual server--> properties-->access--relay-->one the list below--> granted 127.0.0.1

    This I want to check through my windows configuration tool. I hope you understood the problem clearly. Please ask me if you need more information with out any hesitation.

    Thanks in advance

    Sivakumar V

    Thursday, March 20, 2008 1:41 AM
  • User989702501 posted

    Well, i'm not a dev guy. if you are looking for the config, I can tell which key to look in to.. then you can use err. system.directoryservices to access the IPSecurity metabase key under lm/smtpsvc/ node.

    • Marked as answer by Anonymous Tuesday, September 28, 2021 12:00 AM
    Friday, March 21, 2008 12:18 AM
  • User1787869660 posted

    Thanks Bernard,

    Can you help in finding configuration to check " enable drop directory quota" is selected or not.

    this property can be viewed manually default SMTP Server--> domains-->default domain name--> properties

    i have check whether that is selected or deslected. Can you help in this regard.

     

    Thanks in advance

    Sivakumar V

    Saturday, March 22, 2008 9:54 AM
  • User1073881637 posted

    What I would do is load metabase explorer that is part of the IIS 6 reskit and see what properties are needed to check this.  Then in your config tool you can use the system.directoryservices namespace to connect to the appropriate path in the metabase.

    Saturday, March 22, 2008 11:47 PM
  • User989702501 posted

    It should be RouteAction metabase key.... try enable / disable and use metabase explorer to see the value changes. I trace it in XP, when enabled is 1, and 8388609 when disabled.

    Sunday, March 23, 2008 12:32 AM
  • User1787869660 posted

    Hi Bernard,

    Thanks alot for your help. It worked out for me.

     

    Thanks

    Siva.

    • Marked as answer by Anonymous Tuesday, September 28, 2021 12:00 AM
    Sunday, March 23, 2008 2:07 AM
  • User1787869660 posted

    Hi Bernard,

    I tried to access IPSecurity key to obtain relayrestrictions under smtpsvc. but there is no such kind of key existed. can you please tell me the key name under which metabase. i tried with lm/smtpsvc as well as lm/smtpsvc/1 also. Can you please tell me bit elobarately.

    Thanks

    Sivakumar V

    Sunday, March 23, 2008 2:29 AM
  • User989702501 posted

    The key is in binary format :) I don't know the logic behind. the connection control is at ipsecurity key lm/smtpsvc/1, for relay restriction is relayiplist at the same path.

    Anyway, here's a blog post on reading the ipsecurity key. see if it helps.

    Sunday, March 23, 2008 11:49 PM
  • User1787869660 posted

    Hi steve,

    I did the way you told but i am getting system.__object . how can i convert and get the list of ipaddresses.

     

    Thanks

    Sivakumar V

    Wednesday, June 4, 2008 6:10 AM
  • User1073881637 posted

    Here is one way using code.  You'll need to get the IISOLE.dll which is the COM interface.

    1) Download VB 2008 express (search for this link) 

    2) Go to codeplex and download this project, extract the OLEDLL.dll 
    http://www.codeplex.com/SLK

    3) Make a project in VB2008 express

    4) Make a reference to the IISOLE.dll

    5) Paste this code into your main and run

    Dim objValue As New DirectoryEntry("IIS://localhost/smtpsvc/1")
    Dim objIPSec As IISOle.IISIPSecurity = objValue.Properties("RelayIpList").Value
    objIPSec.IPGrant = New Object() {"192.168.55.50", "192.168.22.20"}
    objValue.Properties("RelayIpList").Value = objIPSec
    objValue.CommitChanges()

    Here is a reference of the entire IISOLE.dll. 
    http://www.webtropy.com/articles/art14-2.asp?Interop=IISOle

    • Marked as answer by Anonymous Tuesday, September 28, 2021 12:00 AM
    Wednesday, June 4, 2008 11:46 PM
  • User1787869660 posted

    Hi Bernard,

    I have a similiar request again. I have to check which radio button checked (only the list below or all except the list below.)under SMTP Vertual Server-->Properties-->access-->connection control . I tried with Ipsecurity and it members ipdeny and ipgrant. but it shows only ip list but not which option is selected. Please help me with any key or property or registry entry to look into that.

    Thanks

    Sivakumar V

    Thursday, January 29, 2009 4:37 AM