Sending Gmail through Rebol
From: sabufrancis::rediffmail::com at: 13-Sep-2008 23:47
Hi
I thought I should share this with this list. I believe that this may
help some. I had spent almost two days searching for an answer and
finally I got it: Yes, you can send emails from Rebol to a gmail SMTP
server. This is how you do it:
Install stunnel from www.stunnel.org
Then make a configuration file; say smtpconfig.txt as given below
;;;;;;;;;;;;;;;;;;;
; SMTP configuration for Gmail
output = SMTPgmail.log
taskbar = yes
cert = stunnel.pem
client = yes
[smtps]
protocol = smtp
accept = 192.168.2.25:8025 <http://192.168.2.25:8025>
connect = smtp.gmail.com:587 <http://smtp.gmail.com:587>
;;;;;;;;;;;;;;;;;;;
The "accept" parameter should be the local IP address of your computer.
The port 8025 should be free. If it is not, use some other free port.
The gmail SMTP address and the port (the "connect" parameter) should be
as per the latest Google documentation for it. (They had changed it a
year or so back, so don't expect that 587 also will remain constant)
Now start stunnel thus:
> stunnel smtpconfig.txt
Now in Rebol give your net settings thus:
>> system/schemes/esmtp/host: "192.168.2.25"
>> system/schemes/esmtp/port-id: 8025
>> system/schemes/esmtp/user: "you-gmail.com"
>> system/schemes/esmtp/pass: "mypasswd"
Obviously, "you-gmail.com" and "mypasswd" will be as per your context.
Now you can happily send emails using the regular Rebol "send" function.
I suspect a similar strategy will be useful for other SMTP servers on
which Rebol usually fails (because of incomplete/non-support of TLS,
SSL) I tested this even for Google for Applications (i.e. for domains
hosted on Google gmail service) and it worked. I have tested it only on
the Windows platform but I think it should work similarly if not exactly
the same on Linux too. (stunnel is available for Linux also)
In the above configuration file; I used it only for gmail SMTP. I guess
I it should also work for gmail POP. You would require to add the
following (not tested) and pick up mails from 192.1682.2.25:8110 (or
whatever you had configured for "accept" parameter)
;;;;;;;;;;;;;;;
[spop3]
accept = 192.168.2.25:8110
connect = pop.gmail.com:995
;;;;;;;;;;;;;;;;;;
One last thing; as per info gleaned from
http://forum.eprompter.com/lofiversion/index.php?t307.html there are
some precautions in the stunnel configuration file:
a) you shouldn't add "protocl = smtp" for SMTP/SSL but you need to add
it if the protocol is SMTP/TLS (Which is where I was stuck for hours
before I got the solution).
b) Also for POP/TLS you should add "protocol = pop3" and if it is just
POP/SSL then you should remove it. phew!
Cheers
Regards
Sabu Francis