[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 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 220.127.116.11
smtp-server: get-mx-ip 18.104.22.168 "rebol.com"
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.