gmail and cfmail

281 views
Skip to first unread message

Terry Schmitt

unread,
May 7, 2009, 12:59:17 AM5/7/09
to Railo
Hi All,

I'm setting up a dev server with Railo 3.1 and testing email.
I can send using a local install of postfix with no problem.

I tried setting up smtp.gmail.com, both the free and google apps, and
get nothing but errors. I've reviewed several blog posts about the
security settings and ports relating to gmail. I've tried about every
combination that I can think of... Nothing.

When configuring the email server via the admin GUI, it saves, mostly,
and I run "verify" which returns "OK".
When I select port 587 and TLS, the page clocks and times out, but
other combinations seems to save ok.

I then decided to just set all the settings via the cfmail tag.
I tried every combination listed at:
http://jamiekrug.com/blog/index.cfm/2009/2/13/cfmail-using-Gmail-SMTP
I tried this for both free gmail and a google apps account.

Here are the errors I get depending on what port and security type.
smtp.gmail.com Could not connect to SMTP host: smtp.gmail.com, port:
465
smtp.gmail.com Could not convert socket to TLS

I did have 2 occurrences where Railo/Glassfish maxed out the CPU
during this testing, which was really strange. Once while trying to
save the email server in the GUI and once while executing a page with
cfmail in it. I believe both were when I had TLS set to true. I had to
restart Glassfish in both instances.

At this point, it sure seems like a bug, as the Railo/Glassfish
combination has been working flawlessly so far and there appear to be
no connectivity issues.

Ideas?

T

AJ Mercer

unread,
May 7, 2009, 1:03:05 AM5/7/09
to ra...@googlegroups.com
this is the settings I have

SMTP: smtp.gmail.com
Username: em...@gmail.com
Password: *********
Port: 587
TLS: checked
SSL: not checked



2009/5/7 Terry Schmitt <terry....@gmail.com>



--
AJ Mercer
Web Log: http://webonix.net

Marcos Placoná

unread,
May 7, 2009, 6:53:56 AM5/7/09
to ra...@googlegroups.com
You might wanna take  alook at this blog post, where I explain everything how I did it.

http://www.placona.co.uk/blog/post.cfm/full-google-mail-smtp-power-for-your-domain

2009/5/7 AJ Mercer <ajme...@gmail.com>



--
Marcos Placoná
www.placona.co.uk

Jamie Krug

unread,
May 7, 2009, 9:03:44 AM5/7/09
to Railo
@Terry,

It looks like you've already found my blog post on the topic :) I just
tested all three examples provided in that post (below) with Railo
3.1.0.012 running on Tomcat 6.0.18 and all three worked fine sending
from my gmail.com address.

I've also tested setting the mail configuration in both the Railo
Server Admin and the Railo Web Admin. In both cases, all worked
perfect with smtp.gmail.com/user...@gmail.com/password/587/TLS -- it
verified and mail was sent. However, when I tried using SSL and port
465, the admin page hung for over a minute when I clicked "Update," so
I'd suggest sticking with port 587 and TLS.

I also tested with both my gmail.com account and a Google Apps for
Your Domain account. Both worked. It sounds like something strange is
happening on your setup -- whether it's Glassfish or something else, I
have no idea, sorry! But I can confirm that this does not appear to be
a Railo bug, at least not with 3.1.0.012.

<cfset mailAttributes = {
server="smtp.gmail.com",
username="el.b...@gmail.com",
password="eatmyshorts",
from="el.b...@gmail.com",
to="ho...@thesimpsons.com",
subject="Eat my shorts, man!"
}
/>

<cfmail port="465" useSSL="true"
attributeCollection="#mailAttributes#"
>port 465, SSL enabled</cfmail>

<cfmail port="587" useTLS="true"
attributeCollection="#mailAttributes#"
>port 587, TLS enabled</cfmail>

<cfmail port="465" useSSL="true" useTLS="true"
attributeCollection="#mailAttributes#"
>port 465, SSL and TLS enabled</cfmail>

Best,
Jamie

Terry Schmitt

unread,
May 7, 2009, 11:28:14 AM5/7/09
to Railo
Thanks all for the confirmation that it's working for you...
I have not heard of anyone using Glassfish with Railo, so maybe I have
stumbled on a Glassfish v3 compatibility issue. One think that bothers
me was when Glassfish hogged the CPU at 100%... twice. That is a
little disturbing.
I'll test further tonight and report back.

FYI... this is all on a clean setup using Ubuntu 8.04 host running
Ubuntu 8.04 VM using VMServer. I have a Glassfish v2.1 setup that I
can test on and I'll try the Railo Express version as well.

T

On May 7, 6:03 am, Jamie Krug <jamiek...@gmail.com> wrote:
> @Terry,
>
> It looks like you've already found my blog post on the topic :) I just
> tested all three examples provided in that post (below) with Railo
> 3.1.0.012 running on Tomcat 6.0.18 and all three worked fine sending
> from my gmail.com address.
>
> I've also tested setting the mail configuration in both the Railo
> Server Admin and the Railo Web Admin. In both cases, all worked
> perfect with smtp.gmail.com/usern...@gmail.com/password/587/TLS -- it
> verified and mail was sent. However, when I tried using SSL and port
> 465, the admin page hung for over a minute when I clicked "Update," so
> I'd suggest sticking with port 587 and TLS.
>
> I also tested with both my gmail.com account and a Google Apps for
> Your Domain account. Both worked. It sounds like something strange is
> happening on your setup -- whether it's Glassfish or something else, I
> have no idea, sorry! But I can confirm that this does not appear to be
> a Railo bug, at least not with 3.1.0.012.
>
>         <cfset mailAttributes = {
>                         server="smtp.gmail.com",
>                         username="el.ba...@gmail.com",
>                         password="eatmyshorts",
>                         from="el.ba...@gmail.com",

Jamie Krug

unread,
May 7, 2009, 11:38:31 AM5/7/09
to ra...@googlegroups.com
Terry,

If you're interested in switching from Glassfish to Tomcat, I'm
documenting my installation and configuration on Ubuntu 8.04 Server
(64-bit) here:
http://docs.google.com/Doc?docid=dchcmx7_13dbm8xmgn&hl=en

Best,
Jamie

Michael Offner-Streit

unread,
May 7, 2009, 4:32:49 PM5/7/09
to ra...@googlegroups.com
Hi Terry

when we look to your errors in detail:

"smtp.gmail.com Could not connect to SMTP host: smtp.gmail.com, port:465"
this simple means nobody is listeting on port 465 at smtp.gmail.com


smtp.gmail.com Could not convert socket to TLS
when i google this i get one post that this is a problem with a specific jre version
http://forums-beta.sun.com/thread.jspa?messageID=9742840

but i'm not shure if this really is the problem, i think this method throws the error

package com.sun.mail.smtp;
public class SMTPTransport
private void startTLS() throws MessagingException {
    issueCommand("STARTTLS", 220);
    // it worked, now switch the socket into TLS mode
    try {
        serverSocket = SocketFetcher.startTLS(serverSocket);
        initStreams();
    } catch (IOException ioex) {
        closeConnection();
        throw new MessagingException("Could not convert socket to TLS",
                                ioex);
    }
    }

importend to know here is why this IOException is throwed, to you have more details to this exception (stacktrace ...)

greetings micha


Terry Schmitt schrieb:

Terry Schmitt

unread,
May 7, 2009, 6:13:51 PM5/7/09
to Railo
Jamie,
That is actually kind of funny. I just switched from Tomcat to
Glassfish because I got so annoyed with Tomcat not shutting down! I've
also been keeping my eye on Glassfish and figured this would be a good
chance to try it. Thanks for the doc though. I had created my own
complete install doc. I'd like to compare the two docs.

Michael,
I can grab the stack trace this evening.

Thanks,
Terry

On May 7, 1:32 pm, Michael Offner-Streit <michael.off...@railo.ch>
wrote:
> Hi Terry
>
> when we look to your errors in detail:
> /"smtp.gmail.com Could not connect to SMTP host: smtp.gmail.com, port:465"/
> this simple means nobody is listeting on port 465 at smtp.gmail.com
>
> /smtp.gmail.com Could not convert socket to TLS/
> when i google this i get one post that this is a problem with a specific
> jre versionhttp://forums-beta.sun.com/thread.jspa?messageID=9742840
>
> but i'm not shure if this really is the problem, i think this method
> throws the error
>
> package com.sun.mail.smtp;
> public class SMTPTransport
> private void startTLS() throws MessagingException {
>     issueCommand("STARTTLS", 220);
>     // it worked, now switch the socket into TLS mode
>     try {
>         serverSocket = SocketFetcher.startTLS(serverSocket);
>         initStreams();
>     } catch (IOException ioex) {
>         closeConnection();
>         throw new MessagingException("*Could not convert socket to TLS*",
>                                 *ioex*);
> michael.off...@railo.chwww.railo-technologies.com

Jamie Krug

unread,
May 7, 2009, 8:39:16 PM5/7/09
to ra...@googlegroups.com
@Terry: That is funny :) Let me know how our docs compare -- I'd love
to know if you have any additional tips! I'm still finalizing things,
as this will be my first production-worthy Ubuntu Web server. I'm
working on iptables to firewall ports today...

Best,
Jamie

Terry Schmitt

unread,
May 8, 2009, 12:57:34 AM5/8/09
to Railo
UPDATE:
I used Jamie's basic code with my personal settings and ran several
tests.
I'm no Java/J2EE expert, but it definitely appears to be bug with the
Railo v3.1/Glassfish v3/JDK combination. Which one is at fault? I
really can't answer that one.
I do not believe this is a gmail issue.

It would be a shame if Railo won't work with Glassfish v3, but I'm
inclined to think that this is a Glassfish problem. Someone with
better Java skills may shed some light here.

Here are my findings:

Tests
1: port 465, SSL enabled
2: port 587, TLS enabled
3: port 465, SSL and TLS enabled

All using spoolenable="false" and <cfmail> wrapped with <cftry> so I
can see the results on screen.

******************************************************************************************
Ubuntu/Railo v3.1/Glassfish v3/SUN jdk 1.6.0_07 (from Ubuntu
repository)
******************************************************************************************
1: fail
2: fail
3: fail
These fail immediately. They appear to fail before even contacting
gmail.
I also did a 4th test for this one with no security settings to a
localhost Postfix server. It works fine.

Top portion of stack traces:
smtp.gmail.com Could not connect to SMTP host: smtp.gmail.com, port:
465 at
railo.runtime.net.smtp.SMTPClient._send(SMTPClient.java:724):724 at
railo.runtime.net.smtp.SMTPClient.send(SMTPClient.java:626):626 at
railo.runtime.tag.Mail.doEndTag(Mail.java:480):480 at

smtp.gmail.com Could not convert socket to TLS at
railo.runtime.net.smtp.SMTPClient._send(SMTPClient.java:724):724 at
railo.runtime.net.smtp.SMTPClient.send(SMTPClient.java:626):626 at
railo.runtime.tag.Mail.doEndTag(Mail.java:480):480 at

******************************************************************************************
Ubuntu/Railo v3.1/Glassfish v2.1/SUN jdk 1.6.0_07 (from Ubuntu
repository)
******************************************************************************************
1: success
2: success
3: success
Now this is interesting! It works! This Ubuntu VM is virtually
identical to the VM with Glassfish v3 except for the Glassfish
version.

******************************************************************************************
Win Vista/Railo Express v3.1
******************************************************************************************
1: success
2: success
3: success

Michael Offner-Streit

unread,
May 8, 2009, 2:31:51 AM5/8/09
to ra...@googlegroups.com
Hi Terry

i think one reasion coud be, that javax.mail heavily use the
System.properties parameters and this params are public for all.
can you please execute the follwowing, please add a from and to before

<cftry><cfmail subject="ss" from="" to=""
spoolenable="no"></cfmail><cfcatch></cfcatch></cftry>
<cfset
ser=serialize(createObject('java','java.lang.System').getProperties())>
<cfdump var="#ser#">
<cfdump var="#evaluate(ser)#">

and show me the result of the first dump

greetings micha






Terry Schmitt schrieb:
--
Michael Offner-Streit
Technical Support
Railo Technologies GmbH
michael...@railo.ch

Terry Schmitt

unread,
May 8, 2009, 11:18:35 PM5/8/09
to Railo, Michael Offner-Streit
Michael,

I have sent you the serialized object via email.

Terry

On May 7, 11:31 pm, Michael Offner-Streit <michael...@railo.ch>
wrote:

Terry Schmitt

unread,
May 11, 2009, 11:55:02 AM5/11/09
to Railo
Jira RAILO-231 created.
Reply all
Reply to author
Forward
0 new messages