Insert Company logo in Navision Mail body

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
742wnf7vftf0.png

Answers

  • Mohamed_ZayedMohamed_Zayed Member Posts: 39
    Code is working just fine!
    My mistake was that my record 'CompanyInof' was of type TEMP :tired_face:
  • Mohamed_ZayedMohamed_Zayed Member Posts: 39
    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 displayed
  • foo_barfoo_bar Member Posts: 91
    why not put the logo online and link to that?
  • Mohamed_ZayedMohamed_Zayed Member Posts: 39
    Hi Foo_bar,
    Thanks for your answer, can you be more specific please with some steps :)?
  • foo_barfoo_bar Member Posts: 91
    edited 2017-06-22
    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.
Sign In or Register to comment.