Email Template With Image

jack Ryder asked on May 13, 2014 11:12

Hello everyone.Can anyone help me to use kentico email template with image. Actually i want to use image as content of body message of kentico template . I don't want to Send Image as a Attachment. So can Anybody Help me to sort out these scenario.

Correct Answer

Brenden Kehren answered on May 15, 2014 11:42

Have you looked at using the built-in method to retrieve the avatar? Check out the transformation documentation.

<%# GetUserAvatarImageUrl(Eval("UserAvatarGuid"), Eval("UserID"), 200, 150, 150) %>
0 votesVote for this answer Unmark Correct answer

Recent Answers


Brenden Kehren answered on May 13, 2014 11:24 (last edited on December 10, 2019 02:30)

If the image is stored on your website you can simply use HTML to build the image tag with the src attribute populated. I use something like this with a macro to get the domain:

<img src="{%RootDocument.AbsoluteURL|(identity)GlobalAdministrator%}images/notifications.png" />
1 votesVote for this answer Mark as a Correct answer

jack Ryder answered on May 13, 2014 23:46 (last edited on May 14, 2014 02:56)

Thank you for your reply. I am already use given solution by you. but When I recive email in that i am getting

html as it is. Domain in email get properly but image is not replaced. i am putting above syntax in macro replacement. like as <img src="http://localhost:5252/cmspages/getAvatar.aspx?43cbb96a-bfda-4996-b01a-30c22982fb29"style="margin-right:10px; vertical-align:top;width:200px;"/>

image is not replaced here.i am getting image from kentico cmaavtar table

0 votesVote for this answer Mark as a Correct answer

Brenden Kehren answered on May 14, 2014 09:57

If your debugging while trying to test this, you'll need to ensure the Visual Studio debugger is still running otherwise port 5252 won't be open and your image won't be available.

What method are you using to get the avatar GUID?

0 votesVote for this answer Mark as a Correct answer

jack Ryder answered on May 15, 2014 05:19

once again thank you for your reply. Yes, While i am recieving email that time my debugging in vs-12 is running. And also it is asking for download image . When i click to download image,then image is dissapear.and when i reopen that mail then img(not the image, like alt="image") is comes for a second and gone. and for getting avtar i am using custom method for retriving avtar image from avtar table by guid. AvatarInfo Avatar = AvatarInfoProvider.GetAvatarInfo(AvatarName); if (Avatar != null) { FileCollection obj = new FileCollection(); obj.Name = Avatar.AvatarFileName; obj.type = Avatar.AvatarMimeType; obj.size = Avatar.AvatarFileSize; obj.Content = "data:image/png;base64," + Avatar.AvatarBinary; obj.FileContent = Avatar.AvatarBinary; obj.FileExtension = Avatar.AvatarFileExtension; return Avatar.AvatarGUID;

0 votesVote for this answer Mark as a Correct answer

jack Ryder answered on May 17, 2014 00:14

Yes, That also feasible solution for Getting Avtar from cms Avtar Table.But one question for you Froggeye, In the case of Custom table if my image in custom table then is it possible to retrive that image using macro like u are getting avtar image from the kentico system table.

0 votesVote for this answer Mark as a Correct answer

Brenden Kehren answered on May 17, 2014 09:33

If you have a field in the custom table that utilizes the avatar form control, then yes it should work without a problem.

0 votesVote for this answer Mark as a Correct answer

   Please, sign in to be able to submit a new answer.