Insert Company logo in Navision Mail body

Mohamed_Zayed
Member Posts: 39
Can anyone please look at the next code and tell me what I am doing wrong. I want to add our company logo to the mail.
Code:
CompanyInfo.CALCFIELDS(Picture);
IF CompanyInfo.Picture.HASVALUE THEN BEGIN
CompanyLogo.INIT;
CompanyLogo.GET;
CompanyLogo.Blob := CompanyInfo.Picture;
CompanyLogo.INSERT;
FileLogo := FileManagement.BLOBExport(CompanyLogo,'Signature.jpg',FALSE);
END;
pBodyBlob.Blob.CREATEOUTSTREAM(BodyStream);
BodyStream.WRITETEXT(STRSUBSTNO('%1 ',Text_Dear) + pCustomer.Name);
BodyStream.WRITETEXT('<br><br>');
BodyStream.WRITETEXT(STRSUBSTNO('%1 ',Text_Body));
BodyStream.WRITETEXT('<br><br>');
BodyStream.WRITETEXT(STRSUBSTNO('%1',Test_Regards));
BodyStream.WRITETEXT('<br>');
BodyStream.WRITETEXT('Mohamed Zayed');
BodyStream.WRITETEXT('<br><br>');
BodyStream.WRITETEXT('BA.Service GmbH');
BodyStream.WRITETEXT('<br><br>');
BodyStream.WRITETEXT('<br><br>');
BodyStream.WRITETEXT('<br><br>');
BodyStream.WRITETEXT('<br><br>');
BodyStream.WRITETEXT('<IMG style='HEIGHT: 153px; WIDTH: 445px' src='file:///'+ FileLogo +'''+ 'width=100 height=100>'); // here is the problem
BodyStream.WRITETEXT('<br><br>');
BodyStream.WRITETEXT('<br><br>');
BodyStream.WRITETEXT(STRSUBSTNO('%1',Text_SystemMail));
Results:
Image cant be displayed ---> Donot know why

Code:
CompanyInfo.CALCFIELDS(Picture);
IF CompanyInfo.Picture.HASVALUE THEN BEGIN
CompanyLogo.INIT;
CompanyLogo.GET;
CompanyLogo.Blob := CompanyInfo.Picture;
CompanyLogo.INSERT;
FileLogo := FileManagement.BLOBExport(CompanyLogo,'Signature.jpg',FALSE);
END;
pBodyBlob.Blob.CREATEOUTSTREAM(BodyStream);
BodyStream.WRITETEXT(STRSUBSTNO('%1 ',Text_Dear) + pCustomer.Name);
BodyStream.WRITETEXT('<br><br>');
BodyStream.WRITETEXT(STRSUBSTNO('%1 ',Text_Body));
BodyStream.WRITETEXT('<br><br>');
BodyStream.WRITETEXT(STRSUBSTNO('%1',Test_Regards));
BodyStream.WRITETEXT('<br>');
BodyStream.WRITETEXT('Mohamed Zayed');
BodyStream.WRITETEXT('<br><br>');
BodyStream.WRITETEXT('BA.Service GmbH');
BodyStream.WRITETEXT('<br><br>');
BodyStream.WRITETEXT('<br><br>');
BodyStream.WRITETEXT('<br><br>');
BodyStream.WRITETEXT('<br><br>');
BodyStream.WRITETEXT('<IMG style='HEIGHT: 153px; WIDTH: 445px' src='file:///'+ FileLogo +'''+ 'width=100 height=100>'); // here is the problem
BodyStream.WRITETEXT('<br><br>');
BodyStream.WRITETEXT('<br><br>');
BodyStream.WRITETEXT(STRSUBSTNO('%1',Text_SystemMail));
Results:
Image cant be displayed ---> Donot know why

0
Answers
-
Code is working just fine!
My mistake was that my record 'CompanyInof' was of type TEMP0 -
ok the Code is working fine when I send the Email to my mail. But if I send the mail to someone else the Picture in the mail body wont be displayed!! ---> The reason for that is coz the Pic is saved in Navision magic Path.
Any idea how can i send this mail to someone else and still the Pic will be correctly displayed0 -
why not put the logo online and link to that?1
-
Hi Foo_bar,
Thanks for your answer, can you be more specific please with some steps?
0 -
upload your logo to an online host and link to that image like this
BodyStream.WRITETEXT('<IMG src='http://www.companysite.com/logo.png' width=100 height=100>');
you are also defining width and height twice in your img tag
or use the logo that already is on the website of your company.0
Categories
- All Categories
- 73 General
- 73 Announcements
- 66.6K Microsoft Dynamics NAV
- 18.7K NAV Three Tier
- 38.4K NAV/Navision Classic Client
- 3.6K Navision Attain
- 2.4K Navision Financials
- 116 Navision DOS
- 851 Navision e-Commerce
- 1K NAV Tips & Tricks
- 772 NAV Dutch speaking only
- 617 NAV Courses, Exams & Certification
- 2K Microsoft Dynamics-Other
- 1.5K Dynamics AX
- 320 Dynamics CRM
- 111 Dynamics GP
- 10 Dynamics SL
- 1.5K Other
- 990 SQL General
- 383 SQL Performance
- 34 SQL Tips & Tricks
- 35 Design Patterns (General & Best Practices)
- 1 Architectural Patterns
- 10 Design Patterns
- 5 Implementation Patterns
- 53 3rd Party Products, Services & Events
- 1.6K General
- 1.1K General Chat
- 1.6K Website
- 83 Testing
- 1.2K Download section
- 23 How Tos section
- 252 Feedback
- 12 NAV TechDays 2013 Sessions
- 13 NAV TechDays 2012 Sessions