8 Replies Latest reply on May 13, 2016 10:14 AM by sfpx

    Transactional email service

    sfpx

      I used Mandrill to send emails with multiple attachments from Filemaker Go before they changed to a mailchimp paying addon.

      I'm looking for a similar service (with a free plan) that would let me use the Insert From URL function to send the email with base64 encoded attachments.

      Digital Fusion has updated its script to use SparkPlug but this version requires a plugin so it won't work on IOS device

      https://www.teamdf.com/blogs/sending-email-from-filemaker-using-sparkpost/

       

      I tried ElasticEmail (https://elasticemail.com/  ) and I can send emails just fine but the attachments have to be uploaded via HTTP PUT https://elasticemail.com/api-documentation/attachments-upload

       

      Basically I want a way to send an email with multiple attachments (combination of images and pdf files) in a single email on IOS.

       

      P.S.

      Do you think the new app extension could help with that ?

      An alternative would be to send the message with attachments to the device email app (if it works with multiple attachments).

        • 1. Re: Transactional email service
          skywillmott

          With ElasticEmail, I guess you could modify the php sample script they provide to include base64decoding of attachment data you POST to the php script and save as files on your web server, which in turn would be sent to ElasticEmail as they are in their sample script... However, I guess this would mean the files would effectively be uploaded twice - once from your device as base64, and then from your web host to elasticemail's servers...

           

          Could work ok though.... To use it in say FileMaker Go, you would just do an Insert from URL, with the URL being something like httppost://myserver.com/attachAndEmail.php?to=toname&from=fromname&subject=mysubject&attachments=[base64encoded files]

           

          ... where [base64encodedfiles] could be all your attachments base64 encoded and strung together with some kind of delimiter which your php could then separate back out to individual base64encoded files...

           

          I'm interested in trying it out and seeing how it goes as well....

          • 2. Re: Transactional email service
            sfpx

            Thanks for the reply.

            I thought about trying what you are suggesting but I'm still looking for an easier and more straightforward alternative.

            I think SocketLabs could work.

            I will let you know.

            • 3. Re: Transactional email service
              bigtom

              I use SendGrid. They have a free account but it has limits on monthly sending. You can add attachments from local files.

               

              https://sendgrid.com/

              https://sendgrid.com/docs/API_Reference/Web_API/mail.html

              • 4. Re: Transactional email service
                sfpx

                It works but I'm not sure how to send attachments using the Insert from URL method.

                • 5. Re: Transactional email service
                  bigtom

                  I believe you just add the file as a URL parameter as specified in the second link. There was another question about this here and I think I provided an example.

                  • 6. Re: Transactional email service
                    sfpx

                    Thanks .

                    I have

                    httpspost://api.sendgrid.com/api/mail.send.json?api_user=xxx&api_key=zzz&to=email@email.com&toname=Jim&subject=Sendgrid test&text=testingtextbody&from=myemail@email.com&files[file1.jpg]=

                     

                    If I put something after the "=" it will be stored in the attachment file.jpg but how do I get the binary data to put there ?

                     

                    The email is sent with an attachment but the content of the attachment is invalid.

                    I tried a base64encoded text ...did not work. It simply put the base64 text in the file.

                     

                    Are you sure it's possible using Insert from URL ?

                     

                    I got the attachment to work by using a web viewer as described here

                     

                    FileMaker and Javascript: AJAX POST - Soliant Consulting

                     

                    It works fine on my Mac but I could not get it to work on IOS

                    • 7. Re: Transactional email service
                      bigtom

                      I believe I did it with a text file using a path. Never tried it with direct binary data.

                      • 8. Re: Transactional email service
                        sfpx

                        skywillmott wrote:

                         

                        With ElasticEmail, I guess you could modify the php sample script they provide to include base64decoding of attachment data you POST to the php script and save as files on your web server, which in turn would be sent to ElasticEmail as they are in their sample script... However, I guess this would mean the files would effectively be uploaded twice - once from your device as base64, and then from your web host to elasticemail's servers...

                         

                        Could work ok though.... To use it in say FileMaker Go, you would just do an Insert from URL, with the URL being something like httppost://myserver.com/attachAndEmail.php?to=toname&from=fromname&subject=mysubject&attachments=[base64encoded files]

                         

                        ... where [base64encodedfiles] could be all your attachments base64 encoded and strung together with some kind of delimiter which your php could then separate back out to individual base64encoded files...

                         

                        I'm interested in trying it out and seeing how it goes as well....

                        Well, this general method works with SocketLabs (and I guess it will work with Sendgrid and other services that require JSON)

                        Prepare the JSON string in Filemaker ($JSON)

                        Insert From URL ("httpspost://yoursite.com/yourscript.php?j=" &$JSON)

                        and in your php script

                        $Json=$_POST['j'];

                        $ch = curl_init();

                        curl_setopt($ch, CURLOPT_URL,URL);

                        curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1 );

                        curl_setopt($ch, CURLOPT_POST,           1 );

                        curl_setopt($ch, CURLOPT_POSTFIELDS,     $Json );

                        curl_setopt($ch, CURLOPT_HTTPHEADER,     array('Content-Type: application/json'));

                        $result=curl_exec ($ch);

                        curl_close ($ch);

                         

                        I was able to send an email this way.

                        It's not elegant but at least it works.