Mailing List Archive: 49091 messages
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search
 

[REBOL] smtp not permitted to relay workround

From: gchiu::compkarori::co::nz at: 14-Jun-2005 9:11

For those without smtp services on web servers, and plugins on web pages, you could try this work round. First off, download %dig.r from the library at rebol.org This function gets the lowest MX record given the domain. get-mx-ip: func [ "Returns the ip address of the lowest MX record" nameserver [tuple!] domain [string!] /local ans result ][ result: copy [] ans: read to-url rejoin [ "dig://" nameserver "/MX/" domain ] foreach rec ans/answers [ repend result [ rec/rdata/preference rec/rdata/exchange ] ] ; get the lowest preference for the MX record result: second sort/skip result 2 foreach rec ans/additionals [ if rec/name = result [ return rec/rdata/ip ] ] return read join dns:// result ] So, say you wanted to send an email to caaarl who is at rebol.com My local name server is at 203.96.152.4 So, smtp-server: get-mx-ip 203.96.152.4 "rebol.com" == 216.193.197.238 We can now plug in this value to set-net set-net reduce [ ['myemail--where--com] smtp-server ] And we should be able to send caaarl a message using his own smtp server which should accept mail for him as the address is within the domain the server services ie. it will not be relaying send [caaarl--rebol--com] "test message" Of course you will have to handle errors, and resend if the server is busy etc, which you may not have to do if you have a full smtp server. -- Graham Chiu http://www.compkarori.com/cerebrus http://www.compkarori.com/rebolml