i spent quite literally 2 weeks trying to get stunnel to work so my canon copier would talk to gmail.
the problem was that i could enable SSL on the canon copier but i could not change the port. so it wouldnt talk to gmail.
here is my stunnel.conf for any one who is having as much trouble as i did getting stunnel and gmail to work. the gmail account has pop/imap enabled in the mail settings in gmail. 192.168.150.2 is my internal windows server running stunnel. i could not get 127.0.0.1 to work. i just put my stunnel servers ip in the copier as the mail server 192.168.150.2. also i think i had to turn off smtp auth on the copier for it to work. your mileage may vary...
just copy paste this into your stunnel.conf for gmail.
cert = stunnel.pem
socket = l:TCP_NODELAY=1
socket = r:TCP_NODELAY=1
client = yes
[pop3s]
accept = 110
connect = pop.gmail.com:995
[imaps]
accept = 143
connect = imap.gmail.com:993
[ssmtp]
accept = 25
connect = smtp.gmail.com:465