Excel Report E-Mail Customization
-
Good Afternoon,
I am trying to insert images in to the Excel Report E-Mail but I cannot for the life of me get them in.
I used the default ftl as a template and only one image is called; the mango logo.
It is called in this line
... <img src="${inline}<@img logo="true"/>" ....>
Those values translate as follows
... <img src="cid:/images/logo.png" ....>
Even hardcoding in the above values still brings the proper image but I cannot get any other image brought in to the email. I tried relative and absolute paths and moving images in to different folders but i just can't get it.
Any help?
-
The syntax does feel kinda weird, but I was able to include a different image by editing it like,
<img src="${inline}<@img logo="false" src="add.png"/>" alt="Add"/>
I was able to refer to images in my Mango/overrides/web/images/ directory by name as above.
-
Phillip,
You're right, that does seem weird.
I took what you said to mean that as per your example it was pulling "add.png" from your overrides directory.
If that is what you meant, then that is not the case for me. (Currently on core 3.3.4 and excelReports 3.3.4)
WARN 2018-04-09T16:56:48,218 (com.serotonin.m2m2.rt.maint.work.EmailWorkItem.execute:92) - Error sending email org.springframework.mail.MailSendException: Failed messages: javax.mail.MessagingException: IOException while sending message; nested exception is: java.io.FileNotFoundException: /opt/mango/web/images/logotest.png (No such file or directory) at org.springframework.mail.javamail.JavaMailSenderImpl.doSend(JavaMailSenderImpl.java:474) ~[spring-context-support-4.3.13.RELEASE.jar:4.3.13.RELEASE] at org.springframework.mail.javamail.JavaMailSenderImpl.send(JavaMailSenderImpl.java:345) ~[spring-context-support-4.3.13.RELEASE.jar:4.3.13.RELEASE] at org.springframework.mail.javamail.JavaMailSenderImpl.send(JavaMailSenderImpl.java:362) ~[spring-context-support-4.3.13.RELEASE.jar:4.3.13.RELEASE] at org.springframework.mail.javamail.JavaMailSenderImpl.send(JavaMailSenderImpl.java:350) ~[spring-context-support-4.3.13.RELEASE.jar:4.3.13.RELEASE] at com.serotonin.web.mail.EmailSender.send(EmailSender.java:199) ~[mango-3.3.4.jar:?] at com.serotonin.web.mail.EmailSender.send(EmailSender.java:190) ~[mango-3.3.4.jar:?] at com.serotonin.web.mail.EmailSender.send(EmailSender.java:143) ~[mango-3.3.4.jar:?] at com.serotonin.m2m2.rt.maint.work.EmailWorkItem.execute(EmailWorkItem.java:89) [mango-3.3.4.jar:?] at com.serotonin.m2m2.rt.maint.BackgroundProcessingImpl$WorkItemRunnable.run(BackgroundProcessingImpl.java:674) [mango-3.3.4.jar:?] at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) [?:1.8.0_161] at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) [?:1.8.0_161] at java.lang.Thread.run(Thread.java:748) [?:1.8.0_161]
It still wanted to pull directly from "/opt/mango/web/images". I was, however, able to do the following.
<img src="${inline}<@img logo="false" src="../../overrides/web/images/logotest.png"/>" alt="Logo"/>
Not sure if I interpreted what you wrote incorrectly but nevertheless it is working.
In addition, I attempted to use an absolute path to avoid any issues if a fix is implemented but was greeted with the following
Error sending email org.springframework.mail.MailSendException: Failed messages: javax.mail.MessagingException: IOException while sending message; nested exception is: java.io.FileNotFoundException: /opt/mango/web/images/opt/mango/overrides/web/images/logotest.png (No such file or directory) at org.springframework.mail.javamail.JavaMailSenderImpl.doSend(JavaMailSenderImpl.java:474)
Ed
-
Hmm. You correctly interpreted my meaning that it loaded add.png from the overrides/web/images/ directory. I did test it on the next version of Mango but I don't think anything about how the image loading works should have changed.
Well, glad you got it working!
-
Phillip,
I just came across this post regarding the images not defaulting to the override folder in e-mail reports.
https://forum.infiniteautomation.com/topic/2229/override-logo-doesn-t-replace-logo-on-report-emailsCould this have been fixed on the version you tested on?
-
Having rerun my test on a 3.3.4 instance, yes I believe we fixed it in the development of 3.4, which should be out fairly soon.