none
issue with embedded images in Outlook emails RRS feed

  • Question

  • Hello. I am developing on 1C. I am trying to create a letter with an embedded image and I have 2 problems:

    1) A letter sent from Outlook looks like this https://ibb.co/QD5PF8g

    And in Gmail it looks like this https://ibb.co/QKWwhSs

    Here is the listing that I create it with. Where is the mistake?

    Procedure CreateLetter(Outlook, ElementSend, SpaceName)

    If not ValueCompleted(ElementSend.MainLetterID) then
    Letter = Outlook.CreateItem(0);
    Letter.Subject = ElementSend.Subject;
    Else 
    Try
    MainLetter = SpaceName.GetItemFromID(ElementSend.BasisEntryID);
    Exception
    Return;
    EndTry;
    If the ElementSend.AnswerAll then
    Letter = MainLetter.ReplyAll();
    Else 
    Letter = MainLetter.Reply();
    EndIf;
    EndIf;

    For Each RecipientString from ElementSend.Recipients cycle
    Recipient = Letter.Recipients.Add(RecipientString.Address);
    Recipient.Type = RecipientString.Type;
    EndofCycle;

    ArrayFiles = New Array;

    For Each File from ElementSend.Attachments cycle

    TemporaryFile = Catalog Temporary Files() + "temp.png";

    rFile = New File (Temporary File);
    If rFile.exists(), then
    DeleteFiles (Temporary File);
    EndIf;

    Binary Data = ReceiveTemporaryStorage(ElementSend.LinksBinaryDataFiles);
    BinaryData.Write(TemporaryFile);

    nFile = Letter.Attachments.Add(TemporaryFile,1,0);

    nFile.PropertyAccessor.SetProperty("http://schemas.microsoft.com/mapi/proptag/0x3712001E", "temp.png");
    nFile.PropertyAccessor.SetProperty("http://schemas.microsoft.com/mapi/proptag/0x370E001E", "image/png");

    ArrayFiles.Add(TemporaryFile);

    EndCycle;

    IDObjects = Letter.ItemProperties.Add("IDObject",1);
    IDObjects.Value = String(ItemSend.ObjectIT);

    Letter.PropertyAccessor.SetProperty("http://schemas.microsoft.com/mapi/id/{00062008-000000-000000-C000-0000000046}/8514000B", True);
    Letter.Body = ElementSend.Body;
    Letter.HTMLBody = ElementSend.HTMLBody;
    Letter.BodyFormat = 2;
    Letter.Send(); 

    For EACH Element from ArraysFiles cycle.
    Delete Files (Element);
    End of Cycle;

    EndProcedures


    2) It creates some kind of attachment "noname" what is it and how to remove it? https://ibb.co/L1zwrfw


    Friday, December 27, 2019 8:06 AM

All replies