Jump to content

EmailAttachFileInline


dshenderson
 Share

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

Recommended Posts

Emails with inline graphics use HTML to write the email, the same way web pages do. One important difference is that with a webpage you can specify a URL to a location on the web server to locate an image. With an email, this doesn't work!

The way emails get around this is buy using content IDs, which are references to images which have been sent with the email. To insert an image in-line in an email you reference an attached file's content ID instead of using a URL like you would in a normal webpage's HTML.

A content ID can be anything you want. It's just a name, and you specify it when calling the EmailAttachFileInline function.

In a set variable step you will call EmailAttachFileInline with your data source and content ID.

EmailAttachFileInline (MyTable::MyContianer ; "myContentID")



Then in the HTML of your email you can reference the content IT as the source for your image using a regular HTML image tag.




<img src="cid:myContentID">



If you are hard-coding your html into your calculation you will need to escape the quote characters, but if it's in a file or you enter it into a text field you won't need to worry about doing that.



The documentation.html file which comes with the download of this plugin has an example of this in the description for the EmailAttachFileInline function description.




EmailCreate("[email protected]"; "[email protected]"; "My Newsletter") and

EmailSetBody(

    "<html><body><img src=\"cid:headergif123\">" &

    "



This is an HTML message with embedded images

" &

    "<img src=\"cid:footergif456\">" &

    "</body></html>";

    "html"

) and

EmailAttachFileInline( Globals::headerContainer ; "headergif123" ) and

EmailAttachFileInline( Globals::footerContainer ; "footergif456" ) and

EmailSend

It's a good idea to call each of the Email functions in their own setVariable script step so that error checking is easier to do.

Link to comment
Share on other sites

Emails with inline graphics use HTML to write the email, the same way web pages do. One important difference is that with a webpage you can specify a URL to a location on the web server to locate an image. With an email, this doesn't work!

The way emails get around this is buy using content IDs, which are references to images which have been sent with the email. To insert an image in-line in an email you reference an attached file's content ID instead of using a URL like you would in a normal webpage's HTML.

A content ID can be anything you want. It's just a name, and you specify it when calling the EmailAttachFileInline function.

In a set variable step you will call EmailAttachFileInline with your data source and content ID.

EmailAttachFileInline (MyTable::MyContianer ; "myContentID")



Then in the HTML of your email you can reference the content IT as the source for your image using a regular HTML image tag.




<img src="cid:myContentID">



If you are hard-coding your html into your calculation you will need to escape the quote characters, but if it's in a file or you enter it into a text field you won't need to worry about doing that.



The documentation.html file which comes with the download of this plugin has an example of this in the description for the EmailAttachFileInline function description.




EmailCreate("[email protected]"; "[email protected]"; "My Newsletter") and

EmailSetBody(

    "<html><body><img src=\"cid:headergif123\">" &

    "



This is an HTML message with embedded images

" &

    "<img src=\"cid:footergif456\">" &

    "</body></html>";

    "html"

) and

EmailAttachFileInline( Globals::headerContainer ; "headergif123" ) and

EmailAttachFileInline( Globals::footerContainer ; "footergif456" ) and

EmailSend

It's a good idea to call each of the Email functions in their own setVariable script step so that error checking is easier to do.

Ok. I am still not getting it.

This is what I have.

I have a container field in a database containing the graphic file I want at the email.

The name of the file is "aic.jpg".

I want the graphic as a footer for the email.

How do I do this?

Link to comment
Share on other sites

Ok. I am still not getting it.

This is what I have.

I have a container field in a database containing the graphic file I want at the email.

The name of the file is "aic.jpg".

I want the graphic as a footer for the email.

How do I do this?

Call EmailAttachFileInline( Table::myContainer ; "myContentID" ) in a set variable step

and in the body of your HTML write <img src="cid:myContentID"> as you would use a regular image tag in HTML.

Link to comment
Share on other sites

If you need a hand with this feel free to give me a call or email me with what you are trying to do. 360Works can do the development work for you. Let me know what you're looking for and I'll give you an estimate or a quote for the work.

Link to comment
Share on other sites

This topic is 4394 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
 Share

×
×
  • Create New...

Important Information

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