frankb3

In-line Attachments under body

11 posts in this topic

Wonder if there if there are some go to tutorials for in-line background image behind the body of an email.  Is this even possible?

I successfully have scripts in use that already place a logo in-line, also able to include attachments, and I've hand coded HTML formatted text - so I'm good there.  Just wanted to have the option of adding a gradient under the body text.

 

Thank you

Share this post


Link to post
Share on other sites

You can use a plugin.

e.g. MBS Plugin comes with an example to send email with inline graphics.

See about sending emails here:

http://www.mbs-plugins.com/archive/2016-10-03/Sending_emails_in_FileMaker_wi/monkeybreadsoftware_blog_filemaker

e.g. on the SendMail.AddAttachmentFile you specify the ID for the inline graphic and reference that in a <img> tag in your HTML text.

http://www.mbsplugins.eu/SendMailAddAttachmentFile.shtml

Share this post


Link to post
Share on other sites
5 hours ago, MonkeybreadSoftware said:

You can use a plugin.

e.g. MBS Plugin comes with an example to send email with inline graphics.

See about sending emails here:

http://www.mbs-plugins.com/archive/2016-10-03/Sending_emails_in_FileMaker_wi/monkeybreadsoftware_blog_filemaker

e.g. on the SendMail.AddAttachmentFile you specify the ID for the inline graphic and reference that in a <img> tag in your HTML text.

http://www.mbsplugins.eu/SendMailAddAttachmentFile.shtml

Thanks for the suggestion.  I failed to mention that I'm using FMPHost for my solution.  Under my plan - they control the server side plugins I can use and don't allow adding additional plugins. 

Share this post


Link to post
Share on other sites

If enough people ask, they may add a plugin for you.

Or you take the chance to switch from shared hosting to your own server instance.

Share this post


Link to post
Share on other sites

Hi frankb3,

You can accomplish this by modifying your html.  Here's an example that will place the linux penguin as the background of an email

"<html><body><style>

body {

    background-image: url("http://core0.staticworld.net/images/article/2014/07/linux-tux-100360806-primary.idge.jpg");

}

</style>

<tr>

<td>

<p>Content on a pretty background image.</p>

</td>

</tr>

</table></body></html>"

 

This actually tiles the image as the background so you may have to play with the CSS within the <style> tags a bit to get the look you need but that is the basic concept. I have not tested this method with EmailAttachFileInline but I suspect that if you put a cid in the url("") parameter it may work. 

Share this post


Link to post
Share on other sites
3 hours ago, ryan360Works said:

Hi frankb3,

You can accomplish this by modifying your html.  Here's example that will place the linux penguin as the background of an email


"<html><body><style>

body {

    background-image: url("http://core0.staticworld.net/images/article/2014/07/linux-tux-100360806-primary.idge.jpg");

}

</style>

<tr>

<td>

<p>Content on a pretty background image.</p>

</td>

</tr>

</table></body></html>"

 

This actually tiles the image as the background so you may have to play with the CSS within the <style> tags a bit to get the look you need but that is the basic concept. I have not tested this method with EmailAttachFileInline but I suspect that if you put a cid in the url("") parameter it may work. 

Ryan,

I'm a little perplexed with how this might work with what I already have going on in the script. It includes an inline logo graphic and a calculated field - plus options to add attachments if the particular record happens to have them.   Would you mind taking a look at the following - could I indeed add your solution to mine?

 

EmailCreate( "IHR.CreativeServices@gmail.com" ; "fscales@IHRadio.com" ; Production Order::Email Subject_ProdAdvisToProducer) and  EmailSetBody(      "<html><body><img src=\"cid:IHR-CS-Email-Header-Minimal.gif\">" &"<br>" & Production Order::Production Advisory_08 Producer HTML  & "<br>" &          "</body></html>";      "html"  ) and  EmailAttachFileInline( Production Order::Header Container ; "IHR-CS-Email-Header-Minimal.gif" ) & "<br>"&   ( Production Order::Production Advisory_08 Producer HTML ) & If(IHR_Contracts::Contract_Container05_AA ≠ "";EmailAttachFile(IHR_Contracts::Contract_Container05_AA);"") & If(IHR_Contracts::Contract_Container05_AA Addendum ≠ "";EmailAttachFile(IHR_Contracts::Contract_Container05_AA Addendum);"") & If(Production Order::Document_01 ≠ "";EmailAttachFile(Production Order::Document_01);"")& If(Production Order::Document_02 ≠ "";EmailAttachFile(Production Order::Document_02);"")& If(Production Order::Document_03 ≠ "";EmailAttachFile(Production Order::Document_03);"")     and  EmailSend

 

Share this post


Link to post
Share on other sites

Frankb3,

First, I recommend  that you do not string all of the function calls within one set variable script step. The reason for this is if that step gets an error or causes a problem, it is difficult to narrow down which function call is causing the issue. Also if one of the functions fail, then the whole script step will fail. It is best practice to separate them out in their own script steps and do some error checking with If conditionals and then log the error and/or exit the script if there is an error. 

As for the html, I believe that you can use my solution in your EmailSetBody function call. I think what you need to do would look something like this: 

EmailSetBody("
<html>
  <body>
    <img src=\"cid:IHR-CS-Email-Header-Minimal.gif\">" &"<br>" & Production Order::Production Advisory_08 Producer HTML  & "<br>" &          "       
    <style> 
    body {background-image: url("cid:background123\"); }
    </style>
  </body>
</html>";"html")
EmailAttachFileInline( Images::background ; "background123" )

Like I said before, I haven't tested this with EmailAttachFileInline so I am not sure if that will work but I think it will. If it doesn't you can always use a URL to a hosted image instead.

Share this post


Link to post
Share on other sites

Just to update this thread, the method above will indeed work. I'm sure there are other approaches but this one seems to work fine. I have found that if you do not want the image to repeat and fill the background you can use the properties 

background-repeat: no-repeat;

background-size: cover;

You can pass in different parameters to background-size to get the look and behavior you are looking for.

Share this post


Link to post
Share on other sites

Just out of curiosity have you tested this with? As far as I understand, html support is even less consistent from one e-mail client to another than across browsers...

Share this post


Link to post
Share on other sites

I tested this with Apple Mail and it works. I just test with Gmail and it does not work. The background image comes in as an attachment.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now