3 Replies Latest reply on Oct 20, 2015 6:30 AM by kmtenor

    be_smtp_send returns -1


      We are exploring the use of the BaseElements plugin version 3.1 to enable one of our applications to send multiple attachments from pre-generated PDF containers.  We are running Exchange 2013 and have a working configuration that functions just fine with Filemaker's built-in SMTP send, using TLS and "Plain Password" authentication.  Unfortunately, we cannot get the setup working to simply send a regular email, much less one with multiple attachments.


      I believe I have troubleshot my way through setting up the server connection, using BE_Curl_Set_Option to set the appropriate username and password into CURLOPT_TLSAUTH_USERNAME and CURLOPT_TLSAUTH_PASSWORD.  At least, when I call BE_SMTP_Server and just give it the server name and port (leaving username and password un-configured) following the BE_Curl_Set_Option calls, the function returns an empty string - which the docs say indicates all is well.


      But, when I call BE_SMTP_Send with just the first four parameters, it returns a -1 error.  The only libcurl error code that matches this is "CURLM_CALL_MULTI_PERFORM" - which doesn't seem like a logical error.


      My questions:


      1. Is it correct to assume that we would be able to get the BaseElements plugin to work with a known-working SMTP connection? 


      2. Am I looking at the right library of error codes to diagnose this (libcurl - Error Codes)?  Or is there a different library being used for the BE_SMTP_Send?


      3. Does BE_SMTP_Server actually attempt a connection when it is called?  Or is it just establishing settings?  If I just change the passwords in the BE_Curl_Set_option calls, the call still returns an empty string - so I feel like I'm still missing something here.  Additionally, if I put the username and password into the BE_SMTP_Server command and test with BE_Curl_Trace, I get the "SSL_23_GET_SERVER_HELLO:unknown protocol" error.


      4. Can I please have a hint as to what I am missing to make this work with TLS and Plain Password?


      Thanks in advance.



        • 1. Re: be_smtp_send returns -1



          Don't use CURLOPT_TLSAUTH_USERNAME, use the parameters in the BE_SMTP_Server function instead. When you do that, what curl error do you get?  My guess is that it's 35.


          There's a slightly newer build with an additional TLS option.  Grab a download from one of these :






          and then set this option : BE_Curl_Set_Option ( "BE_CURLOPT_FORCE_STARTTLS" ; true )  STARTTLS is not TLS and is not the same thing, and required an extra parameter.  I haven't documented this yet, it's still only in a beta release, and will appear on the public site once it's final.


          As to the other questions :


          2 ) yes, that's the right place for the curl errors.

          3 ) So BE_SMTP_Server doesn't attempt any connection, it just stores settings for future connections using BE_SMTP_Send.


          If you like the plugin, and want to get access to a technical support site, and emails about these new features in beta as they're released, and help contribute to ongoing development, please consider sponsoring : BaseElements Plugin Sponsorship | Goya Pty Ltd




          • 2. Re: be_smtp_send returns -1

            I think be_smtp_send returning -1 means you actually received an email.


            But really, hope you get it worked out.

            • 3. Re: be_smtp_send returns -1

              Thanks, Nick.


              Yes, the error that comes up without the beta plugin and call to set BE_CURLOPT_FORCE_STARTTLS is 35.  The new version works great, at least for a simple email.  I'm confident the multiple attachments will work, and am very excited to attempt to implement the mailings from the server.


              I've just completed signing our company up for a sponsorship - this is the second time BaseElements has saved us on a project (first was with your excellent BE_WriteTextToFile, which we use for EDI transmission in another application) - we're overdue to pay in.


              Thanks for being a great resource.