Jump to content

In-line Attachments under body


This topic is 2600 days old. Please don't post here. Open a new topic instead.

Recommended Posts

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

Link to comment
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

Link to comment
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. 

Link to comment
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. 

Link to comment
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( "[email protected]" ; "[email protected]" ; 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

 

Link to comment
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.

Link to comment
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.

Link to comment
Share on other sites

This topic is 2600 days old. Please don't post here. Open a new topic instead.

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
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.