已答覆 Need to send attachments in Base64 ??

  • lundi 18 juin 2012 07:54
     
     

    Hi ,

            I need to send attachments in the form of Base64 format,

        I need some inputs please

Toutes les réponses

  • lundi 18 juin 2012 08:35
    Modérateur
     
     Traitée

    Create a multipart message and then use the method Convert.ToBase64String to convert the content of attachment and the send the email. If you need some help with the code for sending mail and refer to these samples


    Please mark the post answered your question as answer, and mark other helpful posts as helpful, it'll help other users who are visiting your thread for the similar problem, Regards -Rohit Sharma (http://rohitt-sharma.blogspot.com/)

  • lundi 18 juin 2012 10:00
     
     Traitée

    HI,

    Here u go..

                string filetoAttach = @"E:\Test.zip";

                byte[] _Buffer = null;

                 System.IO.FileStream _FileStream = new System.IO.FileStream(filetoAttach, System.IO.FileMode.Open, System.IO.FileAccess.Read);

                   System.IO.BinaryReader _BinaryReader = new System.IO.BinaryReader(_FileStream);

                   long _TotalBytes = new System.IO.FileInfo(filetoAttach).Length;

                  _Buffer = _BinaryReader.ReadBytes((Int32)_TotalBytes);            

                    _FileStream.Close();

                    _FileStream.Dispose();

                    _BinaryReader.Close();

                    string base64 = Convert.ToBase64String(_Buffer);


    Regards
    Ritu Raj
    When you see answers and helpful posts,
    please click Vote As Helpful, Propose As Answer, and/or Mark As Answer

  • lundi 18 juin 2012 14:48
     
     Traitée

    You can use wcf Adapter with messageàTemplate format (<bts-msg-body xmlns="http://www.microsoft.com/schemas/bts2010" encoding="base64"/>)

    Please refer this link to understand .

    http://msdn.microsoft.com/en-us/library/bb226478.aspx

    Thanks,

    Chandra Kumar