[Logo] smithproject.org
  [Search] Search   [Recent Topics] Recent Topics   [Members]  Member Listing   [Groups] Back to home page 
Bug: Mail Server connection strings - can't use username containing '@'  XML
Forum Index -> CFML, CFSCRIPT, CFC
Author Message
JAT



Joined: 06/11/2007 23:28:10
Messages: 18
Offline

I think I've found a bug with the implementation of mail server connection strings. You can't use an email address including the '@' sign as the username.

For example, if I want to setup my CF server to use my gmail account, the appropriate string to enter into the smith administrator would be: "account@gmail.com:password@smtp.gmail.com:465"

See this page on gmail.com for more information on proper connection information: http://mail.google.com/support/bin/answer.py?answer=13287

I know that this method does work in retail CF Server, at least as far back as MX6, if not earlier.
[WWW]
tomdonovan



Joined: 11/06/2007 20:20:23
Messages: 38
Offline

The Gmail page says that TLS is required. TLS isn't available in CF7 and earlier versions (or in Smith).

I can get Gmail smtp to work only with CF8 - by checking the new CF8 "Enable TLS connection to mail server" box in the CF8 Admin Mail page,
or by using the new CF8 "useTLS=yes" attribute in the <cfmail> tag.

I am unable to find a way to connect to Gmail smtp with CF7 and earlier versions (or with Smith) because there is no way to specify TLS.

Are you sure you connected to Gmail smtp with CF6 & CF7?

If you do have TLS (i.e. if you are using Adobe CF8), there is no need to use an extra @ sign.
CF8 works fine with "username:password@smtp.gmail.com", where username and password are your regular Gmail username and password.

-tom-
JAT



Joined: 06/11/2007 23:28:10
Messages: 18
Offline

That may be the case, but my bug report still stands. I was only using gmail as an example.

I have a connection string that I would prefer not to share, that does NOT use TLS, and works in CF6 and 7, and uses the exact same format, requiring the extra @ sign.
[WWW]
tomdonovan



Joined: 11/06/2007 20:20:23
Messages: 38
Offline

You could enter a Smith bug for this - but I don't know if the Smith folks will want to fix it.
Open Mail Relays are frowned upon.

If you want to patch the Smith 1.3b4 source code and rebuild Smith yourself - the attached patch will do what you want.

-tom-
 Filename MailServerName.patch [Disk] Download
 Description Mail Server name parsing patch
 Filesize 750 bytes
 Downloaded:  268 time(s)

JAT



Joined: 06/11/2007 23:28:10
Messages: 18
Offline

While it would facilitate the use of open mail relays, I don't think that this situation is exclusive to OMR's. There are pay services you can use to access an SMTP server, and the username you use to connect is a full email address -- not necessarily that which you are specifying as your sender.

I am very interested in applying this patch. Where can I find information on how to apply it? I've never dealt with .patch files before.
[WWW]
JAT



Joined: 06/11/2007 23:28:10
Messages: 18
Offline

I also get a 404 when I try to download the attachment.
[WWW]
tomdonovan



Joined: 11/06/2007 20:20:23
Messages: 38
Offline

Must be something amiss with the forum "upload file" feature.
I haven't noticed anyone using it before - so maybe I'm the first.

If you are unfamiliar with patch files, you might be better off just making this 2-line fix by hand.
  • Make sure you have the Java 1.4 JDK installed and in your PATH (both the j2sdk1.4.?_??\bin and the j2sdk1.4.?_??\jre\bin directory)
  • Make sure you have Apache ANT installed and its \bin directory in your PATH, and the ANT_HOME env var is set
  • Download and extract the Smith source code
  • Edit the file src/web/src/com/youngculture/smith/engine/util/ServerInfo.java and make two changes:
    change line 46 to
    Code:
    		int index = s.lastIndexOf('@');
    change line 62 to
    Code:
    		int colIndex = secondPart.lastIndexOf(':');

  • type ant.bat to build dist\smith-1.3b4.jar (you may need to do this twice before it completes with no errors)
  • replace WEB-INF\lib\smith-1.3b4.jar with the one you just built and start Smith

    This makes Smith look for the last occurrence of @ and : in the server string, not the first, when it identifies the various parts of the string.

    Be careful about case; Java is case-sensitive. The function name must be "lastIndexOf" exactly.

    FYI - the Java String functions like indexOf() and lastIndexOf() are described here.

    Good luck! Let us know how you make out.

    -tom-
  • JAT



    Joined: 06/11/2007 23:28:10
    Messages: 18
    Offline

    Can I use ANT on a debian server? Other than that, I think I can handle the rest.

    And did you mean the SDK, not the JDK? I don't see a download for a 'JDK'
    [WWW]
    tomdonovan



    Joined: 11/06/2007 20:20:23
    Messages: 38
    Offline

    re: "Can I use ANT on a debian server?"

    Sure, no problem! There is a .tar.gz for ANT.
    You'll probably want to read the installation instructions.
    Ditto for the JDK, since I described the Windows version.
    The JDK was called the J2SE SDK back in the 1.4 days - make sure you get the SDK, not the JRE.

    Also - I entered the patch into the Smith SourceForge Patch Tracker, if you want to see the .patch file.

    -tom-
    JAT



    Joined: 06/11/2007 23:28:10
    Messages: 18
    Offline

    Ok, I'm in the process of downloading the Java SDK.

    I've downloaded and installed ANT to /usr/local/ant

    I ran these commands from the ANT documentation:
    Code:
    export ANT_HOME=/usr/local/ant
     export PATH=${PATH}:${ANT_HOME}/bin
    I skipped the JAVA_HOME path for now, until I have the sdk installed.

    I downloaded the smith source here: http://easynews.dl.sourceforge.net/sourceforge/smithos/smith-src-1.3b4.zip

    I edited the ServerInfo.java file as you indicated.

    I know I won't be able to use it yet, but I can't find an ant.bat file anywhere.

    edit: nevermind. After more poking around, I found ant.bat (which I don't need) and the script "ant" in my installed directory: /usr/local/ant/bin

    Now I just need to get java installed and the JAVA_HOME variable set.
    [WWW]
    JAT



    Joined: 06/11/2007 23:28:10
    Messages: 18
    Offline

    Hm, having trouble getting the JAVA_home variable set.

    I downloaded the .bin file for the j2 sdk,

    chmod +x j2sdk-1_4_2_16-linux-i586.bin
    ./j2sdk-1_4_2_16-linux-i586.bin
    ...
    mkdir /usr/local/jdk
    mv j2sdk1.4.2_16/ /usr/local/jdk/

    export JAVA_HOME /usr/local/jdk/j2sdk1.4.2_16

    -bash: export: `/usr/local/jdk/j2sdk1.4.2_16': not a valid identifier

    What am I missing, here?
    [WWW]
    JAT



    Joined: 06/11/2007 23:28:10
    Messages: 18
    Offline

    doh, I figured it out. The ANT docs have the BASH examples right above the CSH examples, and I was looking at the CSH code instead of BASH code. Adding the = back in worked a charm.

    export JAVA_HOME=/usr/local/jdk/j2sdk1.4.2_16

    Now to compile smith.
    [WWW]
    JAT



    Joined: 06/11/2007 23:28:10
    Messages: 18
    Offline

    ... AAAND it works! Thanks so much Tom!
    [WWW]
    orcus



    Joined: 22/01/2007 16:10:52
    Messages: 136
    Offline

    The patch is now added to SVN and will be included in the next build.

    Tom, thanks for the patch, and JAT for the post.
     
    Forum Index -> CFML, CFSCRIPT, CFC
    Go to:   
    Powered by JForum 2.1.6 © JForum Team